/* Layout: application mobile d'abord — en-tête bleu nuit, colonne de 760px max, grandes cibles tactiles pour seniors */
:root {
  --night: #1B2A49;      /* bleu nuit : en-tête, boutons principaux */
  --night-2: #2A3B60;
  --gold: #A8874F;       /* Or : bordures, accents, texte sur bleu nuit */
  --gold-ink: #80612C;   /* Or foncé : petits textes dorés sur fond clair (contraste suffisant) */
  --bg: #F3EAD7;         /* Crème doré */
  --surface: #FFFCF5;    /* Ivoire : cartes */
  --ink: #1B2333;
  --muted: #5D6474;
  --line: #E3D3B0;       /* Filet doré pâle */
  --ok: #2E6B4F;
  --ok-bg: #E6F0EA;
  --warn: #8A5A12;
  --warn-bg: #F1DDB6;
  --danger: #9B2C2C; --danger-bg: #F6DEDA; --on-danger: #FFFFFF;
  --on-night: #F4F1EB;
  /* Calendrier des chambres invités : libre (vert), pris (rouge), à vous (mauve) */
  --libre: #2E6B4F; --libre-bg: #DDEFE3;
  --pris: #9B2C2C;  --pris-bg: #F6DEDB;
  --moi: #6B3FA0;   --moi-bg: #ECE2F7;
  --f-display: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --f-body: "DM Sans", "Helvetica Neue", Arial, sans-serif;
  --r: 14px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --night: #131D33; --night-2: #22304F; --gold: #C9A86A; --gold-ink: #C9A86A; --bg: #0E1422; --surface: #171F31;
  --ink: #ECE7DC; --muted: #A3A9B6; --line: #2A3349; --ok: #7FC4A0; --ok-bg: #1B3329;
  --warn: #E2B66B; --warn-bg: #3A2E18; --danger: #F08A8A; --danger-bg: #3A1C1C; --on-danger: #1B0F0F; --on-night: #F4F1EB;
  --libre: #7FC4A0; --libre-bg: #1B3329; --pris: #F08A8A; --pris-bg: #3A1F22; --moi: #C3A6EC; --moi-bg: #2E2340; color-scheme: dark } }
:root[data-theme="dark"] {
  --night: #131D33; --night-2: #22304F; --gold: #C9A86A; --gold-ink: #C9A86A; --bg: #0E1422; --surface: #171F31;
  --ink: #ECE7DC; --muted: #A3A9B6; --line: #2A3349; --ok: #7FC4A0; --ok-bg: #1B3329;
  --warn: #E2B66B; --warn-bg: #3A2E18; --danger: #F08A8A; --danger-bg: #3A1C1C; --on-danger: #1B0F0F; --on-night: #F4F1EB;
  --libre: #7FC4A0; --libre-bg: #1B3329; --pris: #F08A8A; --pris-bg: #3A1F22; --moi: #C3A6EC; --moi-bg: #2E2340; color-scheme: dark }

html, body { min-height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 18px; line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }
body > main { flex: 1; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--night); }
* { box-sizing: border-box; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.ico { width: 1.2em; height: 1.2em; display: inline-block; flex: none; vertical-align: -0.2em; }
.ico svg { width: 100%; height: 100%; display: block; }

header.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--night); color: var(--on-night);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
header.top .in { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 12px; min-height: 64px; padding-block: 8px; }
.brand { font-family: var(--f-display); font-size: 28px; font-weight: 600; letter-spacing: 0.01em; line-height: 1; }
.brand small { display: block; font-family: var(--f-body); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); margin-top: 4px; font-weight: 500; }
.top .spacer { flex: 1; }
.chip-appt { display: inline-flex; align-items: center; gap: 8px; background: transparent; border: 1px solid rgba(244,241,235,.35); color: var(--on-night); border-radius: 999px; padding: 6px 12px; font-size: 15px; }
.top .chips { display: inline-flex; gap: 6px; flex-wrap: nowrap; }
.top .chips .chip-appt { white-space: nowrap; }
.chip-appt.fin { background: var(--gold); border-color: var(--gold); color: var(--night); font-weight: 600; }
@media (max-width: 440px) { .top .chips .chip-appt { padding: 6px 9px; font-size: 13px; } .top .chips .chip-appt svg { display: none; } .top:has(.chips) .brand small { display: none; } }
.back { background: none; border: 0; color: var(--on-night); display: inline-flex; align-items: center; gap: 6px; padding: 8px 4px; font-size: 16px; }

/* Pied de page bleu nuit, comme l'en-tête */
footer.foot { background: var(--night); color: var(--on-night); border-top: 2px solid var(--gold);
  padding: 20px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
footer.foot .in { max-width: 760px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px; font-size: 16px; }
footer.foot .brand { font-size: 22px; }
footer.foot a { color: var(--on-night); }
footer.foot .muted { color: var(--gold); font-size: 15px; }

main { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 24px 48px; }
.wrap { max-width: 760px; margin: 0 auto; display: grid; gap: 20px; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; text-wrap: balance; margin: 0; line-height: 1.15; }
h1 { font-size: 40px; }
h2 { font-size: 30px; }
h3 { font-size: 24px; }
.lead { color: var(--muted); margin: 6px 0 0; }
.eyebrow { font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-ink); font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; padding: 0 22px; border-radius: 12px; border: 1px solid transparent; font-weight: 600; font-size: 18px; }
.btn-primary { background: var(--night); color: var(--on-night); }
.btn-primary:hover { background: var(--night-2); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-danger { background: transparent; border-color: var(--line); color: var(--danger); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-sm { min-height: 44px; font-size: 16px; padding: 0 16px; }
.full { width: 100%; }

/* Login */
.login { min-height: calc(100vh - 240px); display: grid; place-items: center; }
.login .card { width: 100%; max-width: 440px; padding: 32px 24px; display: grid; gap: 18px; text-align: center; }
.login h1 { font-size: 44px; }
.appt-input { width: 100%; text-align: center; font-size: 40px; letter-spacing: 0.15em; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); font-variant-numeric: tabular-nums; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button { min-height: 60px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 26px; font-variant-numeric: tabular-nums; }
.keypad button:hover { border-color: var(--gold); }
.err { color: var(--danger); font-size: 16px; min-height: 1.4em; }

/* Accueil */
.hello h1 { font-size: 42px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.tile { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px 20px; display: grid; gap: 10px; align-content: start; min-height: 170px; transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--gold); transform: translateY(-1px); }
.tile .ico { width: 44px; height: 44px; color: var(--night); }
.tile b { font-family: var(--f-display); font-size: 27px; font-weight: 600; line-height: 1.1; }
.tile span { color: var(--muted); font-size: 16px; }
.tile .next { font-size: 15px; color: var(--ok); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tile .ico { color: var(--gold); } }
:root[data-theme="dark"] .tile .ico { color: var(--gold); }
.tiles .tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (max-width: 480px) { .tiles { grid-template-columns: 1fr; } .tile { min-height: 0; grid-template-columns: 44px 1fr; column-gap: 16px; } .tile .ico { grid-row: span 3; } }
.admin-link { justify-self: start; }

/* Restaurant */
.day { display: grid; gap: 14px; }
.card.focus { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); scroll-margin-top: 84px; }
.day-head { display: flex; align-items: center; gap: 16px; }
.dish-ico { width: 56px; height: 56px; flex: none; color: var(--ink); }
.day-head .when { font-family: var(--f-display); font-size: 26px; font-weight: 600; line-height: 1.1; }
.day-head .time { color: var(--muted); font-size: 15px; }
.menu-lines { display: grid; gap: 8px; margin: 0; }
.menu-lines div { display: grid; grid-template-columns: 110px 1fr; gap: 12px; }
.menu-lines dt { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-ink); font-weight: 600; padding-top: 4px; }
.menu-lines dd { margin: 0; }
.menu-lines .allerg-txt { display: block; font-size: 18px; font-style: italic; color: var(--muted); margin-top: 2px; }
.choice.allerg { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (max-width: 480px) { .menu-lines div { grid-template-columns: 1fr; gap: 0; } }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice button { min-height: 52px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 8px 12px; font-size: 16px; text-align: left; }
.choice button[aria-pressed="true"] { border-color: var(--night); box-shadow: inset 0 0 0 1px var(--night); font-weight: 600; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .choice button[aria-pressed="true"] { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); } }
:root[data-theme="dark"] .choice button[aria-pressed="true"] { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.guests { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.stepper button { width: 52px; height: 52px; border: 0; background: var(--surface); display: grid; place-items: center; }
.stepper output { min-width: 44px; text-align: center; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.price { color: var(--muted); font-size: 16px; font-variant-numeric: tabular-nums; }
.price b { color: var(--ink); }
.status { display: inline-flex; align-items: center; gap: 8px; background: var(--ok-bg); color: var(--ok); border-radius: 999px; padding: 6px 14px; font-weight: 600; font-size: 16px; justify-self: start; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .btn { flex: 1 1 200px; }
.row.compact > .btn { flex: 0 0 auto; }   /* barres de petits boutons (flèches de semaine, outils) */
.divider { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* Activités */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .dow { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); text-align: center; padding-bottom: 2px; }
.cal button { min-height: 92px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px 6px; display: grid; align-content: start; gap: 4px; text-align: left; min-width: 0; }
.cal button .n { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 16px; }
.cal button .a { font-size: 13px; line-height: 1.25; color: var(--night); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal button .mine { font-size: 12px; color: var(--ok); font-weight: 600; }
.cal button.off { background: transparent; color: var(--muted); }
.cal button.past { opacity: .45; }
.cal button[aria-pressed="true"] { border-color: var(--night); box-shadow: inset 0 0 0 1px var(--night); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cal button .a { color: var(--gold); } :root:not([data-theme="light"]) .cal button[aria-pressed="true"] { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); } }
:root[data-theme="dark"] .cal button .a { color: var(--gold); }
:root[data-theme="dark"] .cal button[aria-pressed="true"] { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
@media (max-width: 560px) { .cal button { min-height: 70px; padding: 6px 4px; } .cal button .a { font-size: 11px; } }
.week-label { font-size: 14px; color: var(--muted); font-weight: 600; margin-top: 6px; }
.facts { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 16px; }
.facts span { display: inline-flex; align-items: center; gap: 6px; }

/* Bien-être */
.days { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.days button { flex: none; min-width: 76px; min-height: 72px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; padding: 6px; line-height: 1.15; }
.days button small { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.days button b { font-size: 22px; font-variant-numeric: tabular-nums; }
.days button[aria-pressed="true"] { background: var(--night); color: var(--on-night); border-color: var(--night); }
.days button[aria-pressed="true"] small { color: var(--on-night); }
.days button i { font-style: normal; font-size: 12px; color: var(--muted); }
.days button.st-mine i { color: var(--ok); font-weight: 600; }
.days button.st-taken, .days button.st-late { background: transparent; }
.days button[aria-pressed="true"] i { color: var(--on-night); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.slot { min-height: 76px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 10px 14px; text-align: left; display: grid; gap: 2px; }
.slot b { font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.slot span { font-size: 14px; color: var(--muted); }
.slot.mine { background: var(--ok-bg); border-color: var(--ok); }
.slot.mine span { color: var(--ok); font-weight: 600; }
.slot.taken { background: transparent; color: var(--muted); cursor: not-allowed; }
.slot.taken b { text-decoration: line-through; text-decoration-thickness: 1px; }

/* Salle de sport : moment (matin / après-midi) au-dessus de l'horaire */
.slot small { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--gold-ink); font-weight: 600; }

/* Commandes : une ligne par produit, quantité à droite */
.prod-list { display: grid; }
.prod-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.prod-row:last-child { border-bottom: 0; }
.prod-row > div { display: grid; min-width: 0; }
.prod-row b { font-size: 19px; }
.prod-row > div > span { color: var(--muted); font-size: 15px; }
.prod-row .stepper { flex: none; }

/* Alerte de nouveaux messages sur l'accueil */
.notif { display: flex; align-items: center; gap: 14px; text-align: left; width: 100%; background: var(--surface); border: 2px solid var(--gold); border-radius: var(--r); padding: 16px 18px; font-size: 17px; }
.notif .ico { width: 36px; height: 36px; color: var(--gold-ink); }
.notif b { display: block; font-size: 19px; }

/* Messagerie : liste des conversations et bulles */
.convs { display: grid; gap: 8px; }
.conv { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.conv:hover { border-color: var(--gold); }
.conv .t { display: grid; min-width: 0; }
.conv small { color: var(--muted); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { flex: none; min-width: 30px; height: 30px; border-radius: 999px; background: var(--night); color: var(--on-night); display: grid; place-items: center; font-weight: 600; font-size: 15px; padding: 0 8px; }
.bulles { display: grid; gap: 10px; max-height: 60vh; overflow-y: auto; padding: 4px; }
.bulle { justify-self: start; max-width: 85%; background: var(--bg); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 10px 14px; }
.bulle.moi { justify-self: end; background: var(--surface); border-color: var(--gold); border-radius: 16px 16px 4px 16px; }
.bulle p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bulle small { color: var(--muted); font-size: 13px; }
.bulle.copie { border-style: dashed; border-color: var(--gold); }
.bulle .etiquette { display: block; color: var(--gold-ink); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: 12px; margin-bottom: 2px; }
.bulle img.photo { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; margin-bottom: 6px; cursor: zoom-in; }
.photo-jointe { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.photo-jointe img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
/* Photo agrandie (back-office) */
.loupe { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.82); display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.loupe img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.bulle.tache-ok { justify-self: stretch; max-width: none; background: var(--ok-bg); border-color: var(--ok); border-radius: 12px; color: var(--ok); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; }

/* Chambres invités : nuits choisies dans le calendrier */
/* Couleurs : vert = libre, rouge = pris, mauve = à vous ; la sélection du séjour en bleu nuit */
.cal button.ch-libre { background: var(--libre-bg); border-color: var(--libre); }
.cal button.ch-libre .a { color: var(--libre); }
.cal button.ch-pris { background: var(--pris-bg); border-color: var(--pris); opacity: 1; }
.cal button.ch-pris .a, .cal button.ch-pris .n { color: var(--pris); }
.cal button.ch-moi { background: var(--moi-bg); border-color: var(--moi); }
.cal button.ch-moi .mine, .cal button.ch-moi .n { color: var(--moi); }
.cal button.nuit-sel, .cal button.nuit-sel[aria-pressed="true"] { background: var(--night); border-color: var(--night); box-shadow: none; }
.cal button.nuit-sel span { color: var(--on-night) !important; }
.legende { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 15px; color: var(--muted); }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { width: 16px; height: 16px; border-radius: 4px; border: 1px solid; display: inline-block; }
.legende .l { background: var(--libre-bg); border-color: var(--libre); }
.legende .p { background: var(--pris-bg); border-color: var(--pris); }
.legende .m { background: var(--moi-bg); border-color: var(--moi); }
.legende .s { background: var(--night); border-color: var(--night); }
/* Semaine affichée : 7 jours sur une ligne, sans défilement */
.days.semaine { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; overflow: visible; padding-bottom: 0; }
.days.semaine button { min-width: 0; padding: 6px 2px; }
.days.semaine button i { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.days.semaine button.passe { opacity: .4; }
.mois-nav b.sem { font-family: var(--f-body); font-size: 18px; text-align: center; }
.cal .vide { min-height: 70px; }
.mois-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mois-nav b { font-family: var(--f-display); font-size: 26px; font-weight: 600; }
.mois-nav button { width: 56px; height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; }
.mois-nav button .ico { width: 26px; height: 26px; }
.mois-nav button[disabled] { opacity: .35; cursor: not-allowed; }

/* Espace ménage : agenda à cocher */
.agenda { display: grid; gap: 8px; }
.tache { display: grid; grid-template-columns: 58px 32px 1fr; align-items: center; gap: 10px; text-align: left; min-height: 64px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.tache .h { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--gold-ink); }
.tache .ico { width: 30px; height: 30px; color: var(--night); }
.tache .t { display: grid; }
.tache small { color: var(--muted); font-size: 15px; }
.tache.fait { background: var(--ok-bg); border-color: var(--ok); }
.tache.fait .ico { color: var(--ok); }
.tache.fait b { text-decoration: line-through; text-decoration-thickness: 1px; }
/* Liste de tâches (jardin, entretien) : la tâche + bouton de suppression à droite */
.todo-ligne { display: flex; align-items: center; gap: 8px; }
.todo-ligne .tache { flex: 1; min-width: 0; }
.tache .retard { color: var(--danger); }

/* Espace intervenant : appartements inscrits, à toucher pour remplir le numéro */
.appt-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.appt-chips button { min-width: 64px; min-height: 52px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; }
.appt-chips button:hover { border-color: var(--gold); }
.appt-chips button.done { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }

/* Service à table (serveur) */
.appt-chips button small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.appt-chips button { flex-direction: column; line-height: 1.15; }
.appt-chips button.choisi { background: var(--night); border-color: var(--night); color: var(--on-night); }
.appt-chips button.choisi small { color: var(--on-night); }
.cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.cats button { flex: none; min-height: 48px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 16px; white-space: nowrap; }
.cats button[aria-pressed="true"] { background: var(--night); border-color: var(--night); color: var(--on-night); }
.svc-bar { position: sticky; bottom: 12px; z-index: 6; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 2px solid var(--night); border-radius: var(--r); padding: 12px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.svc-bar > div:first-child { display: grid; min-width: 0; }
.svc-bar small { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.servi { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; }
.servi-ligne { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 16px; }
.servi-ligne small { color: var(--muted); font-size: 13px; }

/* Back-office : réglage du thème */
.couleurs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.couleurs .field span:first-child { font-size: 15px; }
.couleurs .pick { display: flex; align-items: center; gap: 10px; }
.couleurs input[type=color] { width: 56px; height: 44px; padding: 2px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.couleurs code { font-size: 14px; color: var(--muted); }
.apercu { border: 1px solid; border-radius: 14px; overflow: hidden; max-width: 420px; }
.verifs { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; font-size: 15px; }
.verifs .ok { color: var(--ok); }
.verifs .ok::before { content: "✓ "; }
.verifs .ko { color: var(--danger); font-weight: 600; }
.verifs .ko::before { content: "! "; }

/* Contact */
.tel { font-size: 30px; font-family: var(--f-display); font-weight: 600; font-variant-numeric: tabular-nums; user-select: all; }
label.field { display: grid; gap: 6px; font-weight: 600; font-size: 16px; }
.field select, .field textarea, .field input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface); font-weight: 400; font-size: 18px; }
.field textarea { min-height: 140px; resize: vertical; }
.note { font-size: 15px; color: var(--muted); }
.notice { border-radius: 12px; padding: 12px 16px; font-size: 16px; }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }

/* Gestion */
/* Onglets du back-office : tous visibles, sur plusieurs lignes si besoin (pas de barre de défilement) */
/* Gestion : rubriques (1er niveau) puis onglets de la rubrique (2e niveau) */
.rubriques { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 10px; }
.rubriques button { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font-size: 16px; font-weight: 600; text-align: left; position: relative; }
.rubriques button svg { width: 22px; height: 22px; flex: 0 0 auto; color: var(--gold-ink); }
.rubriques button:hover { border-color: var(--gold); }
.rubriques button[aria-current="true"] { background: var(--night); border-color: var(--night); color: var(--on-night); }
.rubriques button[aria-current="true"] svg { color: var(--gold); }
.rubriques .badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: var(--on-danger); font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.tabs button { border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 999px; font-size: 15px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.tabs button:hover { border-color: var(--gold); }
.tabs button[aria-selected="true"] { background: var(--night); border-color: var(--night); color: var(--on-night); }
/* Options à cocher (back-office) */
.option { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.option input { width: 24px; height: 24px; margin-top: 2px; flex: none; accent-color: var(--night); }
.option span { display: grid; gap: 2px; }
.option small { color: var(--muted); font-size: 15px; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; background: var(--surface); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; background: var(--bg); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
.drop { border: 1.5px dashed var(--line); border-radius: 14px; padding: 28px 18px; text-align: center; display: grid; gap: 10px; justify-items: center; background: var(--surface); }
.drop.over { border-color: var(--gold); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.kpi b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 13px; color: var(--muted); }
.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 600; }
.pill.new { background: var(--warn-bg); color: var(--warn); }
.pill.done { background: var(--ok-bg); color: var(--ok); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--night); color: var(--on-night); padding: 14px 20px; border-radius: 12px; font-size: 17px; z-index: 20; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: calc(100% - 32px); }
@media (prefers-reduced-motion: reduce) { .tile { transition: none; } .tile:hover { transform: none; } }

/* ---------- Bouton SOS (résidents) et alerte SOS (accueil) ---------- */
.sos-btn { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 72px; border-radius: 16px; border: 0; background: var(--danger); color: var(--on-danger); font-size: 22px; font-weight: 700; padding: 8px 20px; }
.sos-btn svg { width: 32px; height: 32px; flex: 0 0 auto; }
.sos-ecran { display: grid; gap: 16px; text-align: center; }
.sos-ecran h1 { margin: 0; }
.sos-ecran .sos-tel { font-size: 34px; font-weight: 700; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.sos-ecran .notice { font-size: 18px; }
.sos-ecran .btn { width: 100%; }
.alerte-sos { position: sticky; top: 0; z-index: 50; background: var(--danger); color: var(--on-danger); padding: 14px 16px; border-radius: 12px; display: grid; gap: 10px; margin-bottom: 16px; animation: sos-pulse 1s ease-in-out infinite alternate; }
.alerte-sos.prise { animation: none; background: var(--danger-bg); color: var(--danger); }
.alerte-sos .row > .btn { flex: 0 0 auto; }
.alerte-sos .btn-ghost { border-color: currentColor; color: inherit; }
@keyframes sos-pulse { from { box-shadow: 0 0 0 0 var(--danger-bg); } to { box-shadow: 0 0 0 8px var(--danger-bg); } }
@media (prefers-reduced-motion: reduce) { .alerte-sos { animation: none; } }

/* ---------- Tickets techniques (app entretien) ---------- */
.ticket { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); display: grid; gap: 4px; margin-top: 10px; }
.ticket p { font-size: 18px; }

/* ---------- Nouvelles (photos des événements) ---------- */
.photos-nouvelle { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 10px; }
.photos-nouvelle img { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); display: block; }
.nv-apercu { display: flex; flex-wrap: wrap; gap: 8px; }
.nv-apercu img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* ---------- Cuisine : fiche recette (une ligne par ingrédient) ---------- */
.fiche-ligne { display: grid; grid-template-columns: 2fr 1fr 1fr 1.4fr auto; gap: 8px; align-items: end; padding: 8px 0; border-bottom: 1px solid var(--line); }
.fiche-ligne .field { margin: 0; }
@media (max-width: 560px) { .fiche-ligne { grid-template-columns: 1fr 1fr; } .fiche-ligne .field:first-child { grid-column: 1 / -1; } .fiche-ligne > .btn { justify-self: start; } }

/* ---------- Avis (étoiles) et sondages sur l'accueil ---------- */
.card.avis { border: 2px solid var(--gold); }
.etoiles { display: flex; justify-content: center; gap: 6px; }
.etoiles button { flex: 1 1 0; min-width: 0; max-width: 64px; height: 60px; border: 0; background: transparent; color: var(--gold-ink); display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; }
.etoiles button svg { width: 100%; max-width: 46px; height: auto; }
.etoiles button.on { color: var(--gold-ink); }
.etoiles button:focus-visible { outline: 3px solid var(--night); }
@media (max-width: 380px) { .etoiles button { width: 52px; height: 52px; } .etoiles button svg { width: 40px; height: 40px; } }
.choix-sondage { display: grid; gap: 8px; }
.choix-sondage .btn { width: 100%; justify-content: flex-start; text-align: left; }
.lien { background: none; border: 0; padding: 6px 0; color: var(--muted); text-decoration: underline; font-size: 16px; justify-self: start; }

/* ---------- Confort de lecture (réglages du résident, <html data-texte> + classes) ---------- */
/* Taille du texte : tout l'écran est agrandi (les tailles sont en px dans ce fichier). Zoom sur <html> : la largeur utile se réduit d'autant, la mise en page s'adapte sans défilement horizontal */
html[data-texte="grand"] { zoom: 1.15; }
html[data-texte="tres_grand"] { zoom: 1.3; }
/* Contraste élevé : noir sur blanc, bordures marquées (l'emporte sur le thème réglable) */
html.contraste {
  --bg: #FFFFFF !important; --surface: #FFFFFF !important; --ink: #000000 !important; --muted: #2B2B2B !important;
  --line: #5A5A5A !important; --gold-ink: #5A3E0E !important; --night: #0B1630 !important;
}
html.contraste .card, html.contraste .tile, html.contraste .btn-ghost, html.contraste .choice button, html.contraste .slot, html.contraste input, html.contraste textarea, html.contraste select { border-width: 2px; border-color: var(--line); }
html.contraste .note, html.contraste .lead { color: var(--ink); }
/* Boutons plus grands et plus espacés */
html.gros-boutons .btn { min-height: 68px; font-size: 20px; padding: 0 26px; }
html.gros-boutons .btn-sm { min-height: 56px; font-size: 18px; }
html.gros-boutons .row { gap: 16px; }
html.gros-boutons .tiles { gap: 20px; }
html.gros-boutons .choice button, html.gros-boutons .slot { min-height: 64px; }
html.gros-boutons .choice { gap: 12px; }
/* En-tête : bouton « Aa » (confort de lecture) */
.chip-aa { font-family: var(--f-title, serif); font-weight: 700; font-size: 17px; padding: 6px 12px; margin-right: 6px; }
.choice.tailles button { display: flex; align-items: center; gap: 10px; }
.ecouter { margin-top: 8px; }
/* Grand texte : l'en-tête reste sur une ligne */
html[data-texte="grand"] .top .brand small, html[data-texte="tres_grand"] .top .brand small { display: none; }
html[data-texte="tres_grand"] .top .chip-appt { font-size: 13px; padding: 5px 9px; }
html[data-texte="tres_grand"] .top .chip-appt svg { display: none; }
html[data-texte="grand"] .top .lib-appt, html[data-texte="tres_grand"] .top .lib-appt { display: none; }
/* Grand texte : les lignes produit (nom + compteur) passent sur deux lignes si besoin */
html[data-texte="grand"] .prod-row, html[data-texte="tres_grand"] .prod-row { flex-wrap: wrap; }

/* ---------- Cuisine : réception d'une livraison (une carte par article) ---------- */
.recep-ligne { display: grid; grid-template-columns: 1fr 130px; gap: 8px 12px; align-items: end; padding: 10px 0; border-bottom: 1px solid var(--line); }
.recep-ligne > div { display: grid; gap: 2px; }
.recep-ligne .field { margin: 0; }
.recep-trace { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; padding: 0 0 10px; border-bottom: 1px solid var(--line); }
.recep-trace .field { margin: 0; }
.recep-trace input { min-width: 0; width: 100%; }
.hyg-frigo { display: grid; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.hyg-frigo:last-child { border-bottom: 0; }
.hyg-moments { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.recep-ligne .pill { grid-column: 1 / -1; justify-self: start; }

/* Urgence envoyée par l'accueil : écran rouge sur l'app des intervenants */
.urgence-ecran { position: fixed; inset: 0; z-index: 1000; background: var(--danger); display: grid; place-items: center; padding: 16px; animation: sos-pulse 1s ease-in-out infinite alternate; }
.urgence-boite { max-width: 640px; width: 100%; display: grid; gap: 20px; color: var(--on-danger); text-align: center; }
.urgence-tete { font-size: 20px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 10px; letter-spacing: .02em; }
.urgence-tete svg { width: 32px; height: 32px; }
.urgence-texte { font-size: 30px; line-height: 1.3; font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.urgence-ok { min-height: 64px; font-size: 22px; background: var(--surface); color: var(--danger); border: 0; border-radius: 14px; font-weight: 700; justify-self: center; padding: 0 32px; }
.urgence-rappel { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.urgence-rappel svg { width: 20px; height: 20px; vertical-align: -4px; }

/* ---------- Éclairage Hue (Gestion et serveurs) ---------- */
.lum-piece.allumee { border-color: var(--gold); }
.lum-scenes, .lum-couleurs { display: flex; flex-wrap: wrap; gap: 8px; }
.lum-lampe { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.lum-couleur { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.lum-couleur:focus-visible { outline: 3px solid var(--night); outline-offset: 2px; }
input.lum-bri { width: 100%; min-height: 44px; accent-color: var(--night); padding: 0; border: 0; background: none; }
.lum-bridge { margin: 18px 0 4px; }
