/*
 * RIBAMBELLE — FEUILLE DE STYLE
 * -----------------------------
 * Tout l'habillage de l'application, d'après la planche « Maquette visuelle/Charte graphique.jpg » :
 * des surfaces douces, tantôt en RELIEF (elles semblent posées sur la page), tantôt en CREUX
 * (elles semblent enfoncées), dans des tons crème, avec un bleu canard profond pour ce qui compte.
 *
 * Sommaire :
 *   1. Couleurs et réglages généraux (clair et sombre)
 *   2. Éléments de base : boutons, champs, interrupteurs, cases, pastilles
 *   3. Volet de saisie, messages, calendrier
 *   4. En-tête et onglets
 *   5. Tableaux (Présence, Intendance, Activités)
 *   6. Plan des couchages
 *   7. Pied de page, écrans larges, impression
 *
 * Le langage des couleurs :
 *   bleu canard (--brand) = l'action, ce qui est coché, ce qui est complet
 *   ocre (--warn)         = il manque quelque chose
 */

/* ---------- 1. Couleurs et réglages généraux ---------- */

:root {
  color-scheme: light;
  --bg: #f0e7de;            /* le fond de la page */
  --surface: #f3ebe0;       /* une surface en relief */
  --hollow: #e7dccd;        /* une surface en creux */
  --ink: #1f1c17;           /* le texte */
  --muted: #7b7366;         /* le texte secondaire */
  --line: rgb(96 78 48 / 0.14);
  --brand: #064b50;         /* bleu canard */
  --brand-soft: #d5e3df;
  --on-brand: #f6f1e8;
  --warn: #9c5a1c;          /* ocre : « il manque quelque chose » */
  --warn-bg: #f4dfc4;
  --danger: #a3352b;
  /* Les deux ombres qui font le relief : une claire en haut à gauche, une brune en bas à droite. */
  --light: rgb(255 252 246 / 0.95);
  --shade: rgb(168 146 110 / 0.42);
  --raise: 6px 6px 14px var(--shade), -6px -6px 14px var(--light);
  --raise-sm: 3px 3px 7px var(--shade), -3px -3px 7px var(--light);
  --sink: inset 3px 3px 6px var(--shade), inset -3px -3px 6px var(--light);
  --sink-sm: inset 2px 2px 4px var(--shade), inset -2px -2px 4px var(--light);
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 24px;
  --sans: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

/* Mode sombre : mêmes reliefs, dans des tons de nuit. Choisi par l'interrupteur du pied de page. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1c2425;
  --surface: #212b2c;
  --hollow: #182021;
  --ink: #ece5d8;
  --muted: #98a19c;
  --line: rgb(255 255 255 / 0.09);
  --brand: #63bdb6;
  --brand-soft: #24403f;
  --on-brand: #0d2526;
  --warn: #e7a968;
  --warn-bg: #3d2f1f;
  --danger: #ef8a7e;
  --light: rgb(255 255 255 / 0.055);
  --shade: rgb(0 0 0 / 0.5);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--bg); color: var(--ink);
  font: 16px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

#app { max-width: 1080px; margin: 0 auto; padding: 0 16px 40px; }
.loading { text-align: center; color: var(--muted); padding: 30vh 0; }

/* ---------- 2. Éléments de base ---------- */

/* Petit titre de rubrique, en capitales, comme sur la planche. */
.eyebrow { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.hint { font-size: 0.86rem; color: var(--muted); }

/* Bouton « pilule » en relief ; il s'enfonce quand on appuie. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 99px;
  background: var(--surface); box-shadow: var(--raise-sm);
  font-weight: 600; font-size: 0.95rem; text-decoration: none; white-space: nowrap;
  transition: box-shadow 0.15s, transform 0.1s;
}
.btn:active { box-shadow: var(--sink-sm); }
.btn--primary { background: var(--brand); color: var(--on-brand); }
.btn--primary:active { filter: brightness(0.92); }
.btn--block { display: flex; width: 100%; }
.btn--danger { color: var(--danger); }
.btn--quiet { box-shadow: none; background: transparent; color: var(--muted); font-weight: 500; padding: 0 12px; }
.btn--quiet:hover { color: var(--ink); }
.btn--quiet.btn--danger:hover { color: var(--danger); }
.btn[disabled] { opacity: 0.5; cursor: default; }

/* Bouton rond ne contenant qu'une icône. */
.iconbtn {
  flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--raise-sm); color: var(--brand);
  transition: box-shadow 0.15s;
}
.iconbtn:active { box-shadow: var(--sink-sm); }
.iconbtn[aria-disabled="true"], .iconbtn[disabled] { opacity: 0.35; pointer-events: none; }

/* Champ de saisie : en creux ; un halo bleu canard quand on écrit dedans. */
.input {
  width: 100%; min-height: 46px; padding: 0 14px; border: 1.5px solid transparent; border-radius: var(--r-md);
  background: var(--hollow); box-shadow: var(--sink-sm); outline: none;
}
.input::placeholder { color: var(--muted); opacity: 0.8; }
.input:focus { border-color: var(--brand); box-shadow: var(--sink-sm), 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
textarea.input { padding: 11px 14px; resize: vertical; min-height: 76px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 0.8rem; font-weight: 600; color: var(--muted); }

/* Interrupteur : une vraie case à cocher, dessinée comme un bouton à glissière. */
.switch { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track { flex: none; position: relative; width: 52px; height: 30px; border-radius: 99px; background: var(--hollow); box-shadow: var(--sink-sm); transition: background 0.2s; }
.switch__track::after {
  content: ""; position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface); box-shadow: 2px 2px 5px var(--shade); transition: transform 0.2s;
}
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track::after { transform: translateX(22px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch--right { justify-content: space-between; }

/* Case à cocher des tableaux : en creux quand elle est vide, bleu canard et en relief une fois cochée. */
.box {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-sm);
  background: var(--hollow); box-shadow: var(--sink-sm); color: transparent;
  transition: background 0.15s, transform 0.1s;
}
.box .icon { width: 16px; height: 16px; stroke-width: 3; }
.box.is-on { background: var(--brand); color: var(--on-brand); box-shadow: 2px 2px 5px var(--shade); }
.box:active { transform: scale(0.9); }

/* Pastille d'un onglet : le nombre d'éléments manquants (ocre), ou une coche (bleu canard). */
.pastille {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
  background: var(--warn-bg); color: var(--warn); font: 700 0.7rem/1 var(--sans); font-style: normal;
  box-shadow: 0 0 0 2px var(--bg);
}
.pastille--ok { background: var(--brand); color: var(--on-brand); padding: 0; }
.pastille--ok .icon { width: 12px; height: 12px; stroke-width: 3.2; }

/* Étiquettes de prénoms à toucher. */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 38px; padding: 0 14px; border-radius: 99px;
  background: var(--surface); box-shadow: var(--raise-sm); font-weight: 600; font-size: 0.9rem;
}
.chip.is-on { background: var(--brand); color: var(--on-brand); box-shadow: var(--sink-sm); }

/* Carte en relief qui porte chaque onglet. */
.card { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--raise); }
.blank { display: grid; gap: 12px; justify-items: center; text-align: center; padding: 44px 20px; color: var(--muted); }
.blank b { color: var(--ink); font-size: 1.1rem; }
.note { margin: 14px 4px 0; font-size: 0.88rem; color: var(--muted); }
.note b { color: var(--warn); font-weight: 600; }

/* ---------- 3. Volet de saisie, messages, calendrier ---------- */

/* Le volet glisse depuis le bas sur téléphone ; c'est une fenêtre centrée sur grand écran. */
.sheet {
  width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; padding: 0; border: 0;
  border-radius: var(--r-xl) var(--r-xl) 0 0; background: var(--surface); color: var(--ink);
  box-shadow: 0 -10px 40px rgb(0 0 0 / 0.25); overflow: auto;
}
.sheet::backdrop { background: rgb(40 32 20 / 0.4); backdrop-filter: blur(3px); }
.sheet[open] { animation: rise 0.22s ease-out; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
.sheet__panel { position: relative; display: grid; gap: 16px; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); outline: none; }
.sheet__panel h2 { font-size: 1.25rem; font-weight: 700; padding-right: 48px; }
.sheet__close { position: absolute; top: 14px; right: 14px; }
.sheet__lead { color: var(--muted); margin-top: -10px; }

.form { display: grid; gap: 14px; }
.form__error { color: var(--danger); font-size: 0.9rem; font-weight: 600; }
.form__row { display: flex; gap: 12px; }
.form__row > * { flex: 1; min-width: 0; }
.form__more { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; }
.checkline { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 0.95rem; cursor: pointer; }
.checkline input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

/* Compteur « − 2 + » pour le nombre de lits. */
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper output { min-width: 28px; text-align: center; font-weight: 700; font-size: 1.15rem; }
.stepper .iconbtn { width: 40px; height: 40px; }

/* Liste de choix (les lieux enregistrés). */
.options { display: grid; gap: 10px; }
.option { display: flex; align-items: center; gap: 8px; }
.option__main {
  flex: 1; min-width: 0; display: grid; gap: 1px; text-align: left; padding: 10px 16px; border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--raise-sm);
}
.option__main small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.option__main.is-on { box-shadow: var(--sink-sm); background: var(--brand-soft); color: var(--brand); }
:root[data-theme="dark"] .option__main.is-on { color: var(--ink); }

/* Messages éphémères : un bandeau bleu canard, avec éventuellement un bouton « Annuler ». */
.toasts {
  position: fixed; inset: auto 0 calc(20px + env(safe-area-inset-bottom)) 0; margin: 0 auto; padding: 0 16px; border: 0; background: none;
  display: grid; gap: 8px; justify-items: center; width: min(460px, 100%); overflow: visible;
}
.toast {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 16px; border-radius: var(--r-lg); background: var(--brand); color: var(--on-brand);
  font-weight: 500; box-shadow: 0 10px 30px rgb(0 0 0 / 0.25); animation: rise 0.2s ease-out;
}
.toast > span { flex: 1; }
.toast--error { background: var(--danger); }
.toast__action { flex: none; min-height: 36px; padding: 0 14px; border-radius: 99px; background: var(--on-brand); color: var(--brand); font-weight: 700; }
/* La barre qui se vide pendant les 8 secondes où l'on peut annuler. */
.toast__timer { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--on-brand); opacity: 0.7; transform-origin: left; animation: drain linear forwards; }
@keyframes drain { to { transform: scaleX(0); } }

/* Calendrier : on touche le premier jour, puis le dernier. */
.cal__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal__head b { text-transform: capitalize; font-size: 1.05rem; }
.cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 4px; text-align: center; }
.cal__grid > span { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; color: var(--muted); padding: 6px 0; }
.cal__day { height: 42px; font-weight: 600; border-radius: 0; }
.cal__day.is-today { text-decoration: underline; text-underline-offset: 4px; }
.cal__day.is-in { background: var(--brand-soft); }
.cal__day.is-start, .cal__day.is-end { background: var(--brand); color: var(--on-brand); }
.cal__day.is-start { border-radius: 99px 0 0 99px; }
.cal__day.is-end { border-radius: 0 99px 99px 0; }
.cal__day.is-start.is-end { border-radius: 99px; }
.cal__sum { text-align: center; font-weight: 600; min-height: 1.5em; }

/* ---------- 4. En-tête et onglets ---------- */

.head { display: grid; gap: 14px; padding: 28px 4px 18px; }
/* Le nom de l'événement est un champ déguisé en titre : on clique, on écrit. */
.head__title {
  width: 100%; margin: 0 -10px; padding: 4px 10px; border: 0; border-radius: var(--r-md); background: transparent; resize: none; overflow: hidden;
  font-size: clamp(1.7rem, 6.4vw, 2.5rem); font-weight: 750; line-height: 1.12; letter-spacing: -0.02em; outline: none;
  transition: background 0.15s, box-shadow 0.15s; field-sizing: content;
}
.head__title:hover { background: color-mix(in srgb, var(--hollow) 55%, transparent); }
.head__title:focus { background: var(--hollow); box-shadow: var(--sink-sm); }
.head__rows { display: grid; gap: 12px; }
.head__row { display: flex; align-items: center; gap: 10px; }
/* Une « fiche » cliquable : les dates, le lieu. */
.fact {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 16px;
  border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--raise-sm); text-align: left;
  transition: box-shadow 0.15s;
}
.fact:active { box-shadow: var(--sink-sm); }
.fact .icon { color: var(--brand); }
.fact > span { display: grid; min-width: 0; line-height: 1.25; }
.fact b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fact small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fact.is-empty b { color: var(--muted); font-weight: 500; }

/* Les quatre onglets : un rail en creux, l'onglet affiché en relief. Ils restent visibles en haut de l'écran. */
.tabsbar { position: sticky; top: 0; z-index: 20; margin: 0 -16px 14px; padding: 8px 16px; background: var(--bg); }
.tabs { display: flex; gap: 4px; padding: 5px; border-radius: var(--r-lg); background: var(--hollow); box-shadow: var(--sink-sm); }
.tabs__btn {
  position: relative; flex: 1; min-width: 0; min-height: 42px; padding: 0 4px; border-radius: var(--r-md);
  font-size: 0.84rem; font-weight: 600; color: var(--muted); transition: color 0.15s;
}
.tabs__btn.is-active { background: var(--surface); box-shadow: var(--raise-sm); color: var(--brand); }
.tabs__btn .pastille { position: absolute; top: -7px; right: 2px; box-shadow: 0 0 0 2px var(--hollow); }

/* ---------- 5. Tableaux (Présence, Intendance, Activités) ---------- */

.gridwrap { overflow-x: auto; border-radius: var(--r-xl); scrollbar-width: thin; }
.grid { border-collapse: separate; border-spacing: 0; font-size: 0.9rem; min-width: 100%; }
.grid th, .grid td { padding: 0; height: 48px; min-width: 50px; text-align: center; font-weight: 500; border-bottom: 1px solid var(--line); }
.grid tbody tr:last-child > * { border-bottom: 0; }

/* La première colonne (prénoms, aliments) reste visible quand on fait défiler vers la droite. */
.grid__corner, .grid tbody th {
  position: sticky; left: 0; z-index: 2; background: var(--surface); text-align: left;
  min-width: 124px; max-width: 150px; padding: 0 6px 0 16px; box-shadow: 1px 0 0 var(--line);
}
.grid__corner { vertical-align: bottom; padding-bottom: 10px !important; }
.grid thead th { height: 36px; }
.grid thead tr:last-child th { border-bottom: 1px solid var(--line); box-shadow: 0 2px 0 var(--line); }
.grid thead tr:last-child th.grid__corner { box-shadow: 1px 0 0 var(--line), 0 2px 0 var(--line); }

/* Un jour : on clique dessus pour choisir les repas qu'il affiche. */
.grid__day { border-left: 1px solid var(--line); }
.daybtn { width: 100%; height: 36px; padding: 0 10px; font-weight: 700; font-size: 0.8rem; text-transform: capitalize; color: var(--brand); white-space: nowrap; }
.daybtn:hover { background: var(--brand-soft); }
.daylabel { font-weight: 700; font-size: 0.8rem; text-transform: capitalize; color: var(--brand); white-space: nowrap; }
.grid__kind { font-size: 0.68rem; font-weight: 700 !important; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); line-height: 1.15; padding: 0 3px !important; }
.is-daystart { border-left: 1px solid var(--line); }
.is-night { background: color-mix(in srgb, var(--hollow) 60%, transparent); }

/* Nom cliquable dans la première colonne. */
.rowbtn { display: flex; align-items: center; gap: 7px; width: 100%; min-height: 44px; text-align: left; font-weight: 600; }
.rowbtn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rowbtn:hover span { color: var(--brand); }
.dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.grid td > .box { vertical-align: middle; }

/* Dernière colonne : le bouton « + » (ajouter un jour, proposer une activité). */
.grid__addcol { min-width: 60px !important; padding: 0 8px !important; border-left: 1px solid var(--line); vertical-align: middle; }
.addbtn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--raise-sm); color: var(--brand);
}
.addbtn:active { box-shadow: var(--sink-sm); }
.addbtn--wide { display: inline-flex; gap: 6px; width: auto; padding: 0 16px 0 12px; border-radius: 99px; font-weight: 600; font-size: 0.88rem; white-space: nowrap; }

/* Dernière ligne : ajouter un participant (ou une ligne d'intendance). */
.grid__add th { padding: 6px 6px 6px 10px !important; }
.addrow { display: flex; align-items: center; gap: 6px; }
.addrow .input { min-height: 38px; padding: 0 10px; font-size: 0.88rem; border-radius: 10px; }
.addrow .addbtn { flex: none; width: 34px; height: 34px; }
.grid__addline { text-align: left !important; padding: 8px 12px !important; }

/* Intendance : une étiquette par case. */
.grid--cells th, .grid--cells td { min-width: 112px; }
.grid--cells .grid__day { text-align: left; padding-left: 14px; }
.grid--cells td { padding: 5px !important; height: 56px; vertical-align: middle; }
.cellchip {
  display: grid; align-content: center; width: 100%; min-height: 46px; padding: 5px 10px; border-radius: var(--r-md);
  text-align: left; line-height: 1.2; overflow: hidden;
}
.cellchip b, .cellchip small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cellchip small { font-size: 0.72rem; color: var(--muted); }
/* Quelqu'un s'en occupe : étiquette en relief. */
.cellchip.is-filled { background: var(--surface); box-shadow: var(--raise-sm); }
.cellchip.is-filled b { font-weight: 650; }
/* Attendu, mais personne encore : la case est pré-remplie avec l'aliment, en pointillés ocre. */
.cellchip.is-empty { border: 1.5px dashed color-mix(in srgb, var(--warn) 60%, transparent); background: color-mix(in srgb, var(--warn-bg) 45%, transparent); color: var(--warn); font-size: 0.84rem; font-weight: 500; }
.cellchip.is-empty small { color: inherit; opacity: 0.85; }
/* Pas prévu à ce repas : un « + » discret permet de l'ajouter. */
.cellchip.is-off { justify-items: center; color: var(--muted); opacity: 0.35; }
.cellchip.is-off:hover, .cellchip.is-off:focus-visible { opacity: 1; background: var(--hollow); }

/* Activités : titre et date en tête de colonne ; dessous, ce qu'il faut prévoir. */
.grid--acts thead th { height: auto; }
.grid--acts th, .grid--acts td { min-width: 108px; }
.actbtn { display: grid; gap: 2px; width: 100%; padding: 10px 8px; line-height: 1.2; }
.actbtn b { font-weight: 700; color: var(--brand); }
.actbtn small { color: var(--muted); font-size: 0.74rem; }
.actbtn:hover { background: var(--brand-soft); }
.grid__prep { font-size: 0.76rem; color: var(--muted); padding: 6px 8px 8px !important; max-width: 150px; vertical-align: top; line-height: 1.25; border-left: 1px solid var(--line); }
.grid--acts .grid__corner { vertical-align: middle; }

/* ---------- 6. Plan des couchages ---------- */

/* Choix de la nuit affichée. */
.nights { display: flex; gap: 4px; padding: 5px; margin: 0 0 14px; border-radius: var(--r-lg); background: var(--hollow); box-shadow: var(--sink-sm); overflow-x: auto; scrollbar-width: none; }
.nights__btn { flex: 1; min-height: 38px; padding: 0 14px; border-radius: var(--r-md); font-size: 0.84rem; font-weight: 600; color: var(--muted); white-space: nowrap; text-transform: capitalize; }
.nights__btn.is-active { background: var(--surface); box-shadow: var(--raise-sm); color: var(--brand); }

/* Le plan de masse : une feuille quadrillée, en creux, sur laquelle les chambres sont dessinées. */
.plan {
  --wall: color-mix(in srgb, var(--brand) 78%, var(--ink));
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0;
  padding: 18px; border-radius: var(--r-xl); box-shadow: var(--sink);
  background:
    linear-gradient(color-mix(in srgb, var(--brand) 9%, transparent) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(90deg, color-mix(in srgb, var(--brand) 9%, transparent) 1px, transparent 1px) 0 0 / 20px 20px,
    var(--hollow);
}
/* Une chambre : des murs épais, une porte dessinée dans l'angle, son nom en cartouche. */
.room {
  position: relative; display: grid; align-content: start; gap: 14px; min-height: 190px;
  margin: 0 -3px -3px 0; padding: 14px 14px 30px; border: 3px solid var(--wall); background: color-mix(in srgb, var(--surface) 82%, transparent);
}
.room::after { /* le battant de la porte : un quart de cercle en pointillés */
  content: ""; position: absolute; right: 18px; bottom: -3px; width: 30px; height: 30px;
  border: 1.5px dashed var(--wall); border-right: 0; border-bottom: 3px solid var(--surface); border-radius: 30px 0 0 0;
}
.room__name {
  justify-self: start; display: inline-flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 10px; margin: -2px 0 0 -2px;
  font-size: 0.74rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; color: var(--wall);
  border: 1.5px solid var(--wall); border-radius: 4px; background: var(--surface);
}
.room__name:hover { background: var(--brand-soft); }
.room__beds { display: flex; flex-wrap: wrap; gap: 14px 12px; align-items: flex-start; }

/* Un lit vu de dessus : un cadre, un oreiller par place, la couverture en bas. */
.bed { display: grid; gap: 4px; }
.bed__frame { display: flex; border: 2px solid var(--wall); border-radius: 9px; background: var(--surface); overflow: hidden; }
.spot { position: relative; display: grid; align-content: end; justify-items: center; width: 92px; height: 112px; padding: 34px 5px 9px; }
.spot + .spot { border-left: 1.5px dashed color-mix(in srgb, var(--wall) 45%, transparent); }
.spot::before { /* l'oreiller */
  content: ""; position: absolute; top: 8px; left: 14px; right: 14px; height: 20px; border-radius: 7px;
  border: 1.5px solid var(--wall); background: var(--bg);
}
.spot::after { /* la couverture */
  content: ""; position: absolute; inset: 38px 0 0; background: var(--hollow);
  border-top: 1.5px solid color-mix(in srgb, var(--wall) 55%, transparent); z-index: 0;
}
.spot span { position: relative; z-index: 1; max-width: 100%; font-size: 0.82rem; font-weight: 700; line-height: 1.15; text-align: center; overflow-wrap: anywhere; }
.spot.is-free span { font-weight: 500; font-size: 0.76rem; color: var(--muted); }
.spot.is-taken::after { background: var(--brand); border-top-color: var(--brand); }
.spot.is-taken span { color: var(--on-brand); }
.spot:hover::after, .spot:focus-visible::after { background: var(--brand-soft); }
.spot.is-taken:hover::after { background: var(--brand); filter: brightness(1.12); }
.spot[disabled] { cursor: default; }
.bed__sheets { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); text-align: center; }
.bed__sheets.is-no { color: var(--warn); }

/* La tuile « + » pour ajouter une chambre : un contour en pointillés, comme une pièce à dessiner. */
.room--add { place-content: center; justify-items: center; gap: 8px; border-style: dashed; border-width: 2px; color: var(--wall); font-weight: 600; background: transparent; min-height: 150px; width: 100%; }
.room--add::after { content: none; }
.room--add:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); }

/* ---------- 7. Pied de page, écrans larges, impression ---------- */

.foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); }
.foot .switch { margin-left: auto; font-size: 0.9rem; color: var(--muted); padding: 0 8px; }

@media (min-width: 680px) {
  #app { padding: 0 28px 56px; }
  .tabsbar { margin: 0 -28px 18px; padding: 10px 28px; }
  .head { padding-top: 44px; }
  .head__rows { grid-template-columns: 1fr 1fr; }
  .tabs__btn { font-size: 0.95rem; min-height: 46px; }
  .tabs__btn .pastille { position: static; margin-left: 8px; vertical-align: 2px; }
  /* Sur grand écran, le volet devient une fenêtre centrée. */
  .sheet { max-width: 460px; margin: auto; border-radius: var(--r-xl); }
  .grid th, .grid td { min-width: 58px; }
  .grid__corner, .grid tbody th { min-width: 170px; max-width: 220px; }
}

/* Respect du réglage « réduire les animations » de l'appareil. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .tabsbar, .foot, .toasts, .grid__add, .grid__addcol, .room--add, .iconbtn { display: none !important; }
  body { background: #fff; }
  .card, .plan { box-shadow: none; }
}
