/* ============================================================
   Chalet IAC — système de design (voir design-spec.md).
   Direction : « GOÉLETTE » — thème nautique de L'Isle-aux-Coudres.
   Marine profond, écume, sable, laiton ; rouge bouée pour le
   danger ; titres serif façon journal de bord. Polices SYSTÈME
   uniquement : CSP stricte, aucune ressource distante.
   Mobile d'abord. L'information n'est jamais portée par la
   couleur seule : chaque type garde une icône ou un préfixe.
   ============================================================ */

:root {
  /* --- Mer et rivage (neutres) --- */
  --papier: #eff3f4;        /* écume — fond de page */
  --surface: #ffffff;
  --surface-2: #e3ebed;     /* brume — fonds discrets */
  --sable: #f3eee0;         /* plage — touches chaudes (aujourd'hui, citations) */
  --bordure: #d8e2e5;
  --bordure-forte: #b7c9cf;
  --encre: #14283a;         /* encre marine */
  --encre-2: #43606f;
  --encre-3: #71909d;

  /* --- Marine et laiton (identité) --- */
  --marine: #14344d;        /* coque — entête, marque */
  --marine-fonce: #0e2638;
  --laiton: #d9a441;        /* détails : lien actif de la nav, filets */
  --ecume: #f4f7f7;         /* texte sur marine */

  /* --- Accent : bleu du fleuve --- */
  --accent: #155e75;
  --accent-fonce: #0f4a5d;
  --accent-pale: #e2eff3;
  --accent-contour: #a9cdd8;
  --anneau-focus: rgb(21 94 117 / 20%);

  /* --- États (danger = rouge bouée) --- */
  --danger: #b3362c;
  --danger-pale: #fceceb;
  --danger-contour: #eec7c2;
  --succes-pale: #e5f2e7;
  --succes-encre: #1f5c31;
  --succes-contour: #bcdcc2;
  --attention-pale: #faf1d7;
  --attention-encre: #77500e;

  /* --- Palette sémantique du calendrier (devis §8) —
         contraste ≥ 4.5:1 avec du texte blanc --- */
  --c-location:  #1e40af;
  --c-proprio:   #166534;
  --c-famille:   #c2410c;
  --c-demande:   #6b7280;
  --c-blocage:   #374151;
  --c-ordures:   #1f2937;
  --c-recyclage: #0369a1;
  --c-compost:   #78350f;
  --c-echeance:  #b91c1c;
  --c-entretien: #6d28d9;

  /* --- Typographie (100 % système) --- */
  --police-texte: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --police-titres: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;

  /* --- Géométrie et relief --- */
  --rayon-s: 8px;
  --rayon-m: 12px;
  --rayon-l: 16px;
  --ombre-1: 0 1px 2px rgb(35 32 26 / 5%), 0 2px 8px rgb(35 32 26 / 4%);
  --ombre-2: 0 2px 6px rgb(35 32 26 / 8%), 0 14px 36px rgb(35 32 26 / 10%);
  --transition: 140ms ease;

  /* Alias hérités */
  --fond: var(--papier);
}

/* ============================================================
   Base
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--police-texte);
  background: var(--fond);
  color: var(--encre);
  line-height: 1.55;
}

[hidden] { display: none !important; }

h1 {
  font-family: var(--police-titres);
  font-weight: 600;
  font-size: 1.55rem;
  letter-spacing: 0.005em;
  margin: 0 0 16px;
}

h2 { font-size: 1.08rem; font-weight: 700; margin: 0 0 8px; }
h3 { font-size: 0.98rem; font-weight: 700; margin: 16px 0 4px; }

.texte-doux { color: var(--encre-2); font-size: 0.95rem; }

a { color: var(--accent); }

code {
  background: var(--surface-2);
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  word-break: break-all;
}

/* ============================================================
   Mise en page
   ============================================================ */

.page-centree {
  min-height: 100vh;   /* repli pour les iOS sans dvh */
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.page {
  max-width: 1040px;
  margin: 0 auto;
  /* espace pour le bouton flottant + barre iOS du bas */
  padding: 16px 14px calc(96px + env(safe-area-inset-bottom, 0px));
}

.carte {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-l);
  padding: 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--ombre-1);
}

/* ============================================================
   Marque
   ============================================================ */

.marque {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--police-titres);
  font-size: 1.06rem;
  font-weight: 600;
  color: var(--ecume);
  white-space: nowrap;
}

.marque svg { color: var(--ecume); flex-shrink: 0; }

.marque-grande {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  margin-bottom: 20px;
}

.marque-grande svg { color: var(--marine); }

.marque-grande .marque-nom {
  font-family: var(--police-titres);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
}

.marque-grande .marque-lieu {
  color: var(--encre-3);
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ============================================================
   Entête de navigation
   ============================================================ */

/* La coque : bande marine profonde, terminée par une vague d'écume.
   padding-top env() : en PWA installée, iOS superpose la barre d'état au
   haut de l'app — on lui laisse sa place (safe area de l'encoche). */
.entete {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--marine);
  color: var(--ecume);
  padding-top: env(safe-area-inset-top, 0px);
}

.entete-haut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px 2px;
  max-width: 1040px;
  margin: 0 auto;
  min-width: 0;
}

.marque { min-width: 0; }
.marque-texte {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entete-nav {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 8px;
  max-width: 1040px;
  margin: 0 auto;
}

.entete-nav::-webkit-scrollbar { display: none; }

.entete-nav a {
  display: inline-block;
  padding: 8px 10px 10px;
  color: #b9cdd9;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color var(--transition);
}

.entete-nav a:hover { color: var(--ecume); }

.entete-nav a.actif {
  color: #fff;
  border-bottom-color: var(--laiton); /* filet de laiton */
}

/* Vague d'écume sous la coque (SVG en ligne, dernier enfant de .entete :
   en absolu pour rester collée à l'entête sticky au défilement). */
.entete-vague {
  position: absolute;
  top: 100%;
  left: 0;
  display: block;
  width: 100%;
  height: 9px;
  color: var(--marine);
  pointer-events: none;
}

/* Menu « Gestion » : les écrans administratifs regroupés. */
.nav-groupe { position: relative; }

.nav-groupe summary {
  list-style: none;
  cursor: pointer;
  display: inline-block;
  padding: 8px 10px 10px;
  color: #b9cdd9;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color var(--transition);
}
.nav-groupe summary::-webkit-details-marker { display: none; }
.nav-groupe summary:hover { color: var(--ecume); }
.nav-groupe summary.actif { color: #fff; border-bottom-color: var(--laiton); }
.nav-groupe[open] summary { color: #fff; }

/* position:fixed OBLIGATOIRE : la nav a overflow-x:auto (défilement au
   pouce) et rognerait un panneau en absolute — le menu paraissait vide.
   Le point d'ancrage est posé par commun.js à l'ouverture. */
.nav-groupe-panneau {
  position: fixed;
  z-index: 60;
  min-width: 190px;
  background: var(--marine);
  border: 1px solid rgb(244 247 247 / 18%);
  border-radius: var(--rayon-m);
  box-shadow: var(--ombre-2);
  padding: 6px;
  display: flex;
  flex-direction: column;
}

.nav-groupe-panneau a {
  display: block;
  padding: 10px 14px;
  border-radius: var(--rayon-s);
  border-bottom: 0 !important;
}

.nav-groupe-panneau a:hover { background: rgb(244 247 247 / 10%); }
.nav-groupe-panneau a.actif { background: rgb(244 247 247 / 14%); color: #fff; }

.entete-droite {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.entete-nom { color: #9db8c6; font-size: 0.88rem; }

.lien-bouton {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  background: none;
  border: 1px solid rgb(244 247 247 / 35%);
  border-radius: 999px;
  color: var(--ecume);
  cursor: pointer;
  padding: 5px 13px;
  transition: border-color var(--transition), background var(--transition);
}

.lien-bouton:hover { border-color: rgb(244 247 247 / 70%); background: rgb(244 247 247 / 8%); }

/* ============================================================
   Formulaires — cibles ≥ 44 px, texte ≥ 16 px (anti-zoom iOS)
   ============================================================ */

label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin: 15px 0 5px;
}

input, select, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 11px 13px;
  border: 1px solid var(--bordure-forte);
  border-radius: var(--rayon-s);
  background: var(--surface);
  color: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--anneau-focus);
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Champs date et heure : Safari iOS leur donne une largeur intrinsèque qui
   déborde des grilles étroites (vécu sur iPhone le 2026-08-26).
   appearance:none les fait obéir à width:100 % comme des champs texte —
   le sélecteur natif s'ouvre toujours au toucher. */
input[type="date"], input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
  max-width: 100%;
  min-height: 46px;
  text-align: left;
}
input::-webkit-date-and-time-value { text-align: left; }

textarea { resize: vertical; }

fieldset {
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-m);
  padding: 4px 16px 16px;
  margin: 18px 0 0;
  background: rgb(246 244 239 / 45%);
}

legend {
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0 8px;
  color: var(--encre-2);
}

.rangee-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
/* min-width:0 : sans lui, un <select> impose la largeur de sa plus longue
   option à la grille et fait déborder la page sur téléphone. */
.rangee-2 > * { min-width: 0; }

.case {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  margin: 15px 0 5px;
}

.case input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.case-consentement { font-weight: 500; align-items: flex-start; }
.case-consentement input { margin-top: 2px; }

/* ============================================================
   Boutons
   ============================================================ */

.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  margin-top: 18px;
  padding: 10px 18px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--rayon-s);
  cursor: pointer;
  box-shadow: var(--ombre-1);
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.bouton:hover { background: var(--accent-fonce); border-color: var(--accent-fonce); }
.bouton:active { transform: translateY(1px); box-shadow: none; }
.bouton:disabled { opacity: 0.7; cursor: wait; transform: none; }

.bouton.secondaire {
  background: var(--surface);
  color: var(--encre);
  border-color: var(--bordure-forte);
}

.bouton.secondaire:hover { background: var(--surface-2); }

.bouton.danger-doux {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--danger-contour);
}

.bouton.danger-doux:hover { background: var(--danger-pale); }

.bouton.compact {
  width: auto;
  min-height: 36px;
  margin-top: 0;
  padding: 5px 13px;
  font-size: 0.86rem;
  box-shadow: none;
}

/* Indicateur de chargement : le hachage bcrypt prend 1-2 s sur le
   Celeron du NAS — sans lui, on croit que ça plante (décision C). */
.bouton.chargement { position: relative; color: transparent; }
.bouton.chargement::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border: 2.5px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: rotation-bouton 0.7s linear infinite;
}
.bouton.secondaire.chargement::after,
.bouton.danger-doux.chargement::after {
  border-color: var(--encre-2);
  border-top-color: transparent;
}
@keyframes rotation-bouton { to { transform: rotate(360deg); } }

/* ============================================================
   Messages
   ============================================================ */

.message-erreur {
  background: var(--danger-pale);
  border: 1px solid var(--danger-contour);
  color: #8c2a22;
  border-radius: var(--rayon-s);
  padding: 10px 13px;
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.message-succes {
  background: var(--succes-pale);
  border: 1px solid var(--succes-contour);
  color: var(--succes-encre);
  border-radius: var(--rayon-s);
  padding: 10px 13px;
  font-size: 0.95rem;
}

/* ============================================================
   Pastilles de filtre
   ============================================================ */

.pastilles { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }

.pastille {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--bordure);
  background: var(--surface);
  color: var(--encre-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), color var(--transition), opacity var(--transition);
}

.pastille[aria-pressed="true"] {
  background: var(--accent-pale);
  border-color: var(--accent-contour);
  color: var(--accent-fonce);
}

.pastille[aria-pressed="false"] { opacity: 0.5; }
.pastille[aria-pressed="false"]:hover { opacity: 0.8; }

/* ============================================================
   Bouton flottant
   ============================================================ */

.fab {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px)); /* barre iOS du bas */
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 18px rgb(35 50 44 / 35%);
  z-index: 15;
  transition: transform var(--transition), background var(--transition);
}

.fab:hover { background: var(--accent-fonce); transform: scale(1.05); }
.fab:active { transform: scale(0.97); }

/* Sur grand écran, le « + » seul passe inaperçu (retour du propriétaire) :
   il devient une pilule étiquetée — le libellé vient de l'attribut title. */
@media (min-width: 701px) {
  .fab {
    width: auto;
    height: 54px;
    border-radius: 999px;
    padding: 0 24px 0 20px;
    font-size: 24px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
  }
  .fab::after {
    content: attr(title);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
  }
}

/* ============================================================
   Dialogues
   ============================================================ */

.dialogue {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);  /* repli pour les iOS sans dvh */
  max-height: calc(100dvh - 40px);
  overflow-y: auto;                /* SANS lui, les boutons du bas d'un long
                                      formulaire sont hors d'atteinte (vécu
                                      sur iPhone le 2026-08-26) */
  overscroll-behavior: contain;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-l);
  padding: 24px;
  box-shadow: var(--ombre-2);
  background: var(--surface);
  color: var(--encre);
}

.dialogue::backdrop {
  background: rgb(32 28 22 / 45%);
  backdrop-filter: blur(2px);
}

.dialogue h2 {
  font-family: var(--police-titres);
  font-size: 1.3rem;
  font-weight: 600;
}

.dialogue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

.dialogue-actions .bouton { width: auto; margin-top: 0; }

/* ============================================================
   Conflits et suggestions
   ============================================================ */

.bloc-conflit { margin-top: 14px; }
.liste-conflits { margin: 8px 0; padding-left: 20px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

.suggestion {
  border-color: var(--accent-contour);
  background: var(--accent-pale);
  color: var(--accent-fonce);
  opacity: 1 !important;
}

/* ============================================================
   Onglets
   ============================================================ */

.barre-outils {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.onglets {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border-radius: 11px;
  padding: 4px;
}

.onglet {
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  border: 0;
  background: none;
  padding: 8px 15px;
  border-radius: var(--rayon-s);
  cursor: pointer;
  color: var(--encre-2);
  transition: background var(--transition), color var(--transition);
}

.onglet.actif {
  background: var(--surface);
  color: var(--encre);
  box-shadow: 0 1px 3px rgb(35 32 26 / 14%);
}

/* ============================================================
   Listes (réservations, invitations)
   ============================================================ */

.liste-reservations {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ligne-reservation {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: left;
  font: inherit;
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-m);
  padding: 13px 15px;
  cursor: pointer;
  box-shadow: var(--ombre-1);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

button.ligne-reservation:hover {
  border-color: var(--accent-contour);
  transform: translateY(-1px);
  box-shadow: var(--ombre-2);
}

.ligne-icone { font-size: 1.35rem; }
.ligne-texte { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ligne-texte strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne-badges { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }

.ligne-invitation { cursor: default; }
.ligne-invitation .ligne-texte { gap: 7px; }
.ligne-boutons { display: flex; gap: 8px; flex-wrap: wrap; }

.ligne-copie {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}

/* ============================================================
   Badges
   ============================================================ */

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-confirmee { background: var(--succes-pale); color: var(--succes-encre); }
.badge-demande { background: var(--surface-2); color: var(--encre-2); }
.badge-annulee, .badge-refusee { background: var(--danger-pale); color: #8c2a22; }
.badge-moi { background: var(--accent-pale); color: var(--accent-fonce); }
.badge-prive { background: var(--attention-pale); color: var(--attention-encre); }
.badge-compte { background: var(--c-echeance); color: #fff; }

/* ============================================================
   Fiche détail
   ============================================================ */

.fiche-ligne {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 0;
  border-bottom: 1px solid var(--surface-2);
}

.fiche-etiquette {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--encre-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.fiche-privee {
  background: var(--attention-pale);
  border-radius: var(--rayon-s);
  padding: 9px 12px;
  border-bottom: 0;
  margin-top: 8px;
}

/* ============================================================
   FullCalendar
   ============================================================ */

#calendrier {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-l);
  padding: 12px;
  box-shadow: var(--ombre-1);

  --fc-border-color: var(--surface-2);
  --fc-page-bg-color: var(--surface);
  --fc-neutral-bg-color: var(--surface-2);
  --fc-today-bg-color: var(--accent-pale); /* aujourd'hui : bleu du fleuve pâle */
  --fc-list-event-hover-bg-color: var(--papier);
  --fc-button-bg-color: var(--surface);
  --fc-button-text-color: var(--encre);
  --fc-button-border-color: var(--bordure-forte);
  --fc-button-hover-bg-color: var(--surface-2);
  --fc-button-hover-border-color: var(--bordure-forte);
  --fc-button-active-bg-color: var(--accent);
  --fc-button-active-border-color: var(--accent);
}

.fc a { color: inherit; text-decoration: none; }

.fc .fc-toolbar-title {
  font-family: var(--police-titres);
  font-size: 1.25rem;
  font-weight: 600;
  text-transform: capitalize;
}

.fc .fc-button {
  text-transform: none;
  font-weight: 600;
  border-radius: var(--rayon-s);
  padding: 5px 12px;
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active { color: #fff; }

.fc .fc-button:focus, .fc .fc-button-primary:focus { box-shadow: 0 0 0 3px var(--anneau-focus) !important; }

.fc .fc-col-header-cell-cushion {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--encre-3);
  padding: 8px 4px;
}

.fc .fc-daygrid-day-number { color: var(--encre-2); font-size: 0.86rem; padding: 5px 7px; }
.fc .fc-day-today .fc-daygrid-day-number { color: var(--accent-fonce); font-weight: 700; }

.fc .fc-event {
  border-radius: 5px;
  font-size: 0.8rem;
  padding: 1px 4px;
  border-width: 1px;
}

.fc .fc-event.evt-location { background: var(--c-location); border-color: var(--c-location); }
.fc .fc-event.evt-proprio { background: var(--c-proprio); border-color: var(--c-proprio); }
.fc .fc-event.evt-famille { background: var(--c-famille); border-color: var(--c-famille); }
.fc .fc-event.evt-blocage { background: var(--c-blocage); border-color: var(--c-blocage); }
.fc .fc-event.evt-ordures { background: var(--c-ordures); border-color: var(--c-ordures); }
.fc .fc-event.evt-recyclage { background: var(--c-recyclage); border-color: var(--c-recyclage); }
.fc .fc-event.evt-compost { background: var(--c-compost); border-color: var(--c-compost); }
.fc .fc-event.evt-echeance { background: var(--c-echeance); border-color: var(--c-echeance); }
.fc .fc-event.evt-entretien { background: var(--c-entretien); border-color: var(--c-entretien); }

/* Weekends et jours fériés : la plage de sable (demande du propriétaire).
   Les fériés arrivent en événements d'arrière-plan (source « ferie »). */
.fc .fc-daygrid-day.fc-day-sat,
.fc .fc-daygrid-day.fc-day-sun { background: var(--sable); }
.fc .jour-ferie { background: var(--sable); opacity: 1; }
.fc .fc-daygrid-day.fc-day-today { background: var(--fc-today-bg-color); }

/* Demande en attente : hachuré + bordure pointillée (devis §8) */
.fc .fc-event.evt-demande {
  background: repeating-linear-gradient(45deg, #6b7280 0 8px, #8f97a3 8px 16px);
  border: 2px dashed #4b5563;
}

/* Pastilles de couleur de la vue Liste */
.fc .evt-location .fc-list-event-dot { border-color: var(--c-location); }
.fc .evt-proprio .fc-list-event-dot { border-color: var(--c-proprio); }
.fc .evt-famille .fc-list-event-dot { border-color: var(--c-famille); }
.fc .evt-blocage .fc-list-event-dot { border-color: var(--c-blocage); }
.fc .evt-ordures .fc-list-event-dot { border-color: var(--c-ordures); }
.fc .evt-recyclage .fc-list-event-dot { border-color: var(--c-recyclage); }
.fc .evt-compost .fc-list-event-dot { border-color: var(--c-compost); }
.fc .evt-echeance .fc-list-event-dot { border-color: var(--c-echeance); }
.fc .evt-entretien .fc-list-event-dot { border-color: var(--c-entretien); }
.fc .evt-demande .fc-list-event-dot { border-color: #6b7280; }

.fc .fc-list { border-radius: var(--rayon-s); overflow: hidden; }
.fc .fc-list-day-cushion { background: var(--papier); }

/* ---------- Compactage mobile (téléphones) ---------- */

@media (max-width: 700px) {
  .page { padding-left: 10px; padding-right: 10px; }
  h1 { font-size: 1.3rem; }
  .carte { padding: 18px 16px; }

  /* Rangée de marque : le nom de l'usager cède la place sur petit écran. */
  .entete-nom { display: none; }

  /* Filtres du calendrier : UNE ligne défilable au pouce, pastilles fines. */
  .pastilles {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    margin-left: -10px;
    margin-right: -10px;
    padding: 2px 10px 6px;
  }
  .pastilles::-webkit-scrollbar { display: none; }
  .pastille { flex-shrink: 0; font-size: 0.8rem; padding: 5px 11px; }

  /* Barre FullCalendar compacte. */
  .fc .fc-toolbar.fc-header-toolbar { flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
  .fc .fc-toolbar-title { font-size: 1rem; }
  .fc .fc-button { padding: 4px 9px; font-size: 0.85rem; }
  #calendrier { padding: 8px; border-radius: var(--rayon-m); }
  .fc .fc-list-event-title, .fc .fc-list-event-time { font-size: 0.88rem; }

  /* Dialogues collés au bas, pleine largeur utile, safe area respectée. */
  .dialogue {
    width: calc(100vw - 16px);
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  }

  /* Ajout manuel (collectes) : le bouton descend sous les champs. */
  .ligne-ajout { grid-template-columns: 1fr 1fr; }
  .ligne-ajout .bouton.compact { grid-column: 1 / -1; }

  /* Sommaire des mois (comptes) : 3 colonnes au lieu de 4. */
  .sommaire-mois { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 480px) {
  /* Sur téléphone, les paires de champs s'empilent : chaque champ respire. */
  .rangee-2 { grid-template-columns: 1fr; gap: 0; }
}

/* ============================================================
   Page publique (formulaire de demande)
   ============================================================ */

.page-publique {
  padding: 24px 16px 48px;
  display: flex;
  justify-content: center;
}

.carte-large { max-width: 580px; }

.carte-large h2 {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--surface-2);
  color: var(--accent-fonce);
}

.resume-dates { min-height: 1.5em; font-size: 0.95rem; }

/* Piège à robots : hors écran, jamais display:none */
.hp { position: absolute; left: -9999px; top: -9999px; height: 1px; overflow: hidden; }

/* ============================================================
   Sélecteur de dates (formulaire public)
   ============================================================ */

.so-entete { display: flex; align-items: center; justify-content: space-between; margin: 8px 0; }
.so-titre { font-family: var(--police-titres); font-weight: 600; font-size: 1.06rem; text-transform: capitalize; }

.so-nav {
  font: inherit;
  font-size: 1.3rem;
  line-height: 1;
  width: 42px;
  height: 42px;
  border: 1px solid var(--bordure-forte);
  border-radius: var(--rayon-s);
  background: var(--surface);
  color: var(--encre);
  cursor: pointer;
  transition: background var(--transition);
}

.so-nav:hover:not(:disabled) { background: var(--surface-2); }
.so-nav:disabled { opacity: 0.35; cursor: default; }

.so-grille { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.so-jours-semaine {
  margin-bottom: 4px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--encre-3);
}

.so-jour {
  font: inherit;
  font-size: 0.95rem;
  aspect-ratio: 1;
  min-height: 40px;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-s);
  background: var(--surface);
  color: var(--encre);
  cursor: pointer;
  padding: 0;
  transition: background var(--transition), border-color var(--transition);
}

.so-jour:hover:not(:disabled):not(.so-occupe) { border-color: var(--accent-contour); }
.so-jour.so-passe { opacity: 0.3; cursor: default; background: var(--surface-2); border-color: transparent; }
.so-jour.so-occupe { background: var(--surface-2); color: var(--encre-3); text-decoration: line-through; border-color: transparent; }
.so-jour.so-arrivee, .so-jour.so-depart {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}
.so-jour.so-plage { background: var(--accent-pale); border-color: var(--accent-contour); }

.so-legende {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: var(--encre-2);
}

.so-legende span { display: inline-flex; align-items: center; gap: 5px; }
.so-pastille { width: 12px; height: 12px; border-radius: 4px; background: var(--surface); border: 1px solid var(--bordure-forte); display: inline-block; }
.so-pastille-occupee { background: var(--surface-2); border-color: transparent; }
.so-pastille-choisie { background: var(--accent); border-color: var(--accent); }

.so-message { color: #8c2a22; font-size: 0.9rem; margin: 8px 0 0; }

/* ============================================================
   Écran Demandes (admin)
   ============================================================ */

.titre-section { margin-top: 36px; }
.liste-cartes { display: flex; flex-direction: column; gap: 12px; }

.carte-demande { max-width: none; }
.carte-demande-entete { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.carte-demande-dates { font-weight: 700; margin: 6px 0; }

.citation {
  margin: 10px 0;
  padding: 9px 14px;
  border-left: 3px solid var(--laiton);
  background: var(--sable);
  border-radius: 0 var(--rayon-s) var(--rayon-s) 0;
  font-style: italic;
  color: var(--encre-2);
}

.carte-formulaire { max-width: none; margin-bottom: 14px; }

/* ============================================================
   Page de séjour du locataire
   ============================================================ */

.corps-sejour { background: var(--papier); }

.hero-marine {
  position: relative;
  background: linear-gradient(180deg, var(--marine-fonce), var(--marine));
  color: var(--ecume);
  text-align: center;
  padding: 42px 16px 34px;
}

.hero-marine .fanion { fill: var(--laiton); }

.hero-surtitre {
  margin: 14px 0 4px;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #a8c2d1;
}

.hero-titre {
  font-family: var(--police-titres);
  font-size: 1.9rem;
  font-weight: 600;
  margin: 0;
  color: #fff;
}

.hero-vague {
  position: absolute;
  top: 100%;
  left: 0;
  display: block;
  width: 100%;
  height: 9px;
  color: var(--marine);
  pointer-events: none;
}

.page-sejour {
  max-width: 640px;
  padding-top: 26px;
  padding-bottom: 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.page-sejour .carte { max-width: none; }

.dates-sejour {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin: 6px 0 4px;
}

.date-bloc {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--papier);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-m);
  padding: 12px 14px;
}

.date-bloc strong { font-size: 1.02rem; line-height: 1.3; }

.dates-fleche { color: var(--encre-3); font-size: 1.2rem; }

.texte-centre { text-align: center; }

.pied-sejour { margin-top: 10px; font-style: italic; }

a.bouton { text-decoration: none; }

/* Rendu Markdown des infos pratiques */
.prose h1, .prose h2, .prose h3 { font-family: var(--police-texte); font-size: 1rem; margin: 14px 0 4px; }
.prose p { margin: 6px 0; }
.prose ul, .prose ol { margin: 6px 0; padding-left: 22px; }
.prose li { margin: 3px 0; }
.prose code { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; font-size: 0.85em; }
.prose hr { border: 0; border-top: 1px solid var(--bordure); margin: 14px 0; }
.prose blockquote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--laiton); background: var(--sable); border-radius: 0 var(--rayon-s) var(--rayon-s) 0; }
.prose table { border-collapse: collapse; width: 100%; }
.prose th, .prose td { border: 1px solid var(--bordure); padding: 6px 9px; text-align: left; font-size: 0.92rem; }

@media (max-width: 460px) {
  .dates-sejour { grid-template-columns: 1fr; }
  .dates-fleche { display: none; }
}

/* ============================================================
   Écran Comptes
   ============================================================ */

.ligne-echeance { cursor: default; }
.ligne-echeance .bouton.compact { margin-top: 4px; }
.ligne-passee { opacity: 0.65; }

.carte-retard {
  max-width: none;
  border-color: var(--danger-contour);
  background: var(--danger-pale);
  margin-bottom: 12px;
}
.carte-retard .liste-reservations { margin-top: 10px; }

.sommaire-ligne {
  display: grid;
  grid-template-columns: minmax(96px, auto) 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 0.93rem;
}

.sommaire-barre {
  height: 10px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.sommaire-barre i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.sommaire-montant { font-weight: 700; white-space: nowrap; }

.sommaire-mois {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 14px;
}

.sommaire-mois-cellule {
  display: flex;
  flex-direction: column;
  background: var(--papier);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-s);
  padding: 6px 8px;
  font-size: 0.8rem;
}

/* ============================================================
   Écran Réglages
   ============================================================ */

.page-reglages { max-width: 720px; }

.etat-grille {
  display: grid;
  grid-template-columns: minmax(96px, auto) 1fr;
  gap: 7px 14px;
  align-items: baseline;
  font-size: 0.93rem;
}
.etat-grille > div:nth-child(odd) {
  font-weight: 700;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--encre-3);
}
.carte-systeme h3, #etat-contenu h3 { margin: 14px 0 4px; }
.boutons-systeme { margin-top: 14px; }
.details-doux { margin: 10px 0; }
.details-doux summary { cursor: pointer; font-weight: 600; }
.details-doux p { margin: 8px 0; font-size: 0.92rem; color: var(--encre-2); }

/* ============================================================
   Écran Collectes
   ============================================================ */

.carte-apercu { border-color: var(--accent-contour); background: var(--accent-pale); }

.chips-dates { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }

.chip {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--accent-contour);
  color: var(--accent-fonce);
}

.chip-doublon { border-color: var(--bordure-forte); color: var(--encre-3); text-decoration: line-through; }
.chip-rejet { border-color: var(--danger-contour); color: var(--danger); background: var(--danger-pale); }

.barre-liste { margin-top: 26px; }
.sans-marge { margin: 0; }
.filtre-compact { width: auto; font-size: 0.9rem; padding: 8px 10px; }

.ligne-ajout {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.ligne-ajout .bouton.compact { min-height: 44px; }

.titre-mois {
  margin: 18px 0 8px;
  font-family: var(--police-titres);
  font-size: 1.05rem;
  text-transform: capitalize;
  color: var(--encre-2);
}

.ligne-collecte { cursor: default; }
.ligne-collecte .ligne-badges { flex-direction: row; align-items: center; }

/* ============================================================
   Écran Entretien
   ============================================================ */

.liste-historique {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.93rem;
}

.carte-taches { max-width: none; margin-bottom: 16px; }
.ligne-tache { cursor: default; }
.tache-faite { text-decoration: line-through; color: var(--encre-3); }
.ligne-ajout-tache { grid-template-columns: 1fr auto; margin: 10px 0 12px; }

.bloc-fait {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--accent-pale);
  border: 1px solid var(--accent-contour);
  border-radius: var(--rayon-m);
}
.bloc-fait h3 { margin-top: 0; }

/* ============================================================
   PWA — bandeau hors-ligne
   ============================================================ */

.bandeau-hors-ligne {
  position: sticky;
  top: 0;
  z-index: 40;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  background: var(--attention-pale);
  color: var(--attention-encre);
  border-bottom: 1px solid #ecd9a8;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 8px 12px;
}
.apercu-infos {
  margin-top: 14px;
  border: 1px dashed var(--bordure-forte);
  border-radius: var(--rayon-m);
  padding: 12px 16px;
  background: var(--papier);
}
