/* ------ Palette « atelier textile » ------ */
:root {
  --linen:       #faf7f2;
  --linen-warm:  #efe6d7;
  --paper:       #fffdf9;
  --indigo:      #3a4270;
  --indigo-deep: #2d3561;
  --terracotta:  #be5b33;
  --ocre:        #c9a447;
  --sauge:       #7d9b7c;
  --ink:         #2b2822;
  --ink-soft:    #5c5548;
  --thread:      #d4c8b0;
  --font-body:   'Karla', 'Helvetica Neue', system-ui, sans-serif;
  --font-display:'Fraunces', 'Georgia', serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body); color: var(--ink);
  background: var(--linen);
  background-image:
    repeating-linear-gradient(45deg, transparent 0 24px, rgba(45,53,97,.02) 24px 25px),
    repeating-linear-gradient(-45deg, transparent 0 24px, rgba(190,91,51,.02) 24px 25px);
  min-height: 100vh; line-height: 1.55;
}
a { color: var(--indigo-deep); }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: .3em 0 .5em; }
h1 { font-size: 2.4rem; letter-spacing: -.01em; }
h2 { font-size: 1.65rem; }
h3 { font-size: 1.2rem; }

/* ------ En-tête ------ */
.masthead {
  background: var(--indigo-deep); color: var(--linen);
  border-bottom: 4px solid var(--terracotta);
  position: sticky; top: 0; z-index: 50;
}
.masthead-inner {
  width: min(1240px, 96vw); margin: 0 auto;
  display: flex; align-items: center; gap: .9rem;
  padding: .6rem 0; flex-wrap: nowrap;
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit; flex: 0 0 auto; }
.brand-logo svg { display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
.brand-kicker { display: block; font-size: .58rem; letter-spacing: .22em; text-transform: uppercase; color: #b9bdd4; }
.brand-name { display: block; font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; line-height: 1.1; }
.nav {
  display: flex; gap: .9rem; margin-left: auto; flex-wrap: nowrap;
  min-width: 0; overflow: hidden;
}
.nav a {
  color: inherit; text-decoration: none; font-weight: 500; font-size: .95rem;
  padding: .3rem .2rem; border-bottom: 2px solid transparent; white-space: nowrap;
}
.nav a.active { border-bottom-color: var(--terracotta); }
.nav a:hover { color: #fff; }
.user-zone { display: flex; align-items: center; gap: .45rem; flex: 0 0 auto; }
.role-badge {
  padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,.15);
  font-size: .72rem; font-weight: 600; letter-spacing: .04em;
}
.role-badge.visiteur   { background: #5c637d; }
.role-badge.membre     { background: var(--sauge); }
.role-badge.locataire  { background: var(--terracotta); }
.role-badge.comite     { background: var(--ocre); }
.role-badge.admin      { background: #a33b2e; }

/* ------ Boutons ------ */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--terracotta); color: #fff; border: none;
  padding: .55rem 1.1rem; border-radius: 999px; font: 600 .92rem var(--font-body);
  cursor: pointer; text-decoration: none;
  transition: background .15s, transform .1s;
}
.btn:hover { background: #a34e2a; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: transparent; color: var(--indigo-deep); border: 1.5px solid var(--indigo-deep); }
.btn.secondary:hover { background: rgba(45,53,97,.08); }
.btn.ghost { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.4); }
.btn.ghost:hover { background: rgba(255,255,255,.1); }
.btn.small { padding: .35rem .7rem; font-size: .8rem; }
.btn.success { background: var(--sauge); }
.btn.success:hover { background: #6a8368; }
.btn.danger { background: #a33b2e; }
.btn.danger:hover { background: #8a2f24; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ------ Main ------ */
main { width: min(1180px, 94vw); margin: 2rem auto 3rem; }
.section-title { margin: 0 0 1rem; }
.empty-note {
  padding: 2rem; background: var(--paper); border: 1px dashed var(--thread);
  border-radius: 12px; color: var(--ink-soft); text-align: center;
}

/* ------ Hero d'accueil ------ */
.hero {
  background: linear-gradient(135deg, var(--linen-warm) 0%, var(--linen) 100%);
  border: 1px solid var(--thread); border-radius: 18px;
  padding: 2.5rem 2rem; margin-bottom: 2rem;
  text-align: center; position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; top: -30px; right: -30px;
  width: 200px; height: 200px; background: var(--terracotta); opacity: .08;
  border-radius: 50%; filter: blur(20px);
}
.hero-kicker {
  font-size: .78rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--terracotta); font-weight: 700; margin-bottom: .5rem;
}
.hero h1 { font-size: 2.6rem; margin: 0 0 .5rem; }
.hero h1 em { color: var(--terracotta); font-style: italic; }
.hero-lead { font-size: 1.05rem; color: var(--ink-soft); max-width: 640px; margin: 0 auto 1.5rem; }
.hero-actions { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }

/* ------ Grilles de cartes ------ */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.2rem; margin-bottom: 2rem;
}
.card {
  background: var(--paper); border: 1px solid var(--thread); border-radius: 14px;
  padding: 1.1rem 1.3rem; display: flex; flex-direction: column; gap: .5rem;
  transition: transform .15s, box-shadow .15s;
}
.card.clickable { cursor: pointer; }
.card.clickable:hover {
  transform: translateY(-2px); box-shadow: 0 8px 24px rgba(45,53,97,.1);
  border-color: var(--terracotta);
}
.card h3 { margin: 0; }
.card-meta { display: flex; gap: .8rem; font-size: .82rem; color: var(--ink-soft); flex-wrap: wrap; }
.card-desc { color: var(--ink-soft); font-size: .92rem; margin: 0; }
.card-actions { display: flex; gap: .4rem; margin-top: auto; padding-top: .5rem; flex-wrap: wrap; }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: var(--linen-warm); color: var(--ink); font-size: .72rem; font-weight: 700;
  letter-spacing: .03em;
}
.badge.evenement { background: var(--indigo); color: #fff; }
.badge.cours     { background: var(--sauge); color: #fff; }
.badge.atelier   { background: var(--ocre); color: #fff; }
.badge.repas     { background: var(--terracotta); color: #fff; }
.badge.reunion   { background: #5c637d; color: #fff; }
.badge.public    { background: var(--sauge); color: #fff; }
.badge.prive     { background: #5c637d; color: #fff; }
.badge.comite    { background: var(--terracotta); color: #fff; }
.badge.pinned    { background: var(--ocre); color: #fff; }

/* Choix de visibilité pour un événement */
.visibility-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .5rem; }
.visibility-opt {
  display: flex; align-items: center; gap: .5rem;
  padding: .7rem; border: 2px solid var(--thread); border-radius: 10px;
  cursor: pointer; background: var(--paper);
  transition: all .15s;
}
.visibility-opt:hover { background: var(--linen); }
.visibility-opt.selected {
  border-color: var(--terracotta); background: #fdf3e7;
}
.vis-icon { font-size: 1.5rem; }
.vis-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.vis-body strong { font-size: .88rem; }
.vis-body small { color: var(--ink-soft); font-size: .74rem; line-height: 1.3; }
@media (max-width: 720px) { .visibility-choice { grid-template-columns: 1fr; } }

/* ------ Statuts booking ------ */
.status-pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: .74rem; font-weight: 700;
}
.status-en_attente { background: #fdecc8; color: #6b4a12; }
.status-validee    { background: #d7e9d9; color: #2f6b3d; }
.status-refusee    { background: #f0d0d0; color: #7a2828; }

/* ------ Formulaires ------ */
.form-modal { max-width: 500px; }
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1rem; }
.field label { font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.rec-tag {
  display: inline-block; margin-left: .3rem;
  background: var(--sauge); color: #fff;
  padding: 1px 8px; border-radius: 999px;
  font-size: .68rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase;
}
.field input, .field select, .field textarea {
  padding: .55rem .8rem; border: 1.5px solid var(--thread); border-radius: 8px;
  font: inherit; background: var(--paper); color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--terracotta);
  box-shadow: 0 0 0 3px rgba(190,91,51,.15);
}
.field textarea { resize: vertical; min-height: 90px; font-family: inherit; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.checks { display: flex; gap: 1rem; flex-wrap: wrap; margin: .3rem 0; }
.checks label { display: flex; align-items: center; gap: .3rem; font-size: .9rem; cursor: pointer; }
.form-error { color: #a33b2e; font-size: .85rem; margin: .3rem 0; }

/* ------ Modale ------ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(45,53,97,.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 100;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--paper); border-radius: 16px; padding: 1.6rem 1.8rem;
  width: min(560px, 100%); max-height: 92vh; overflow-y: auto;
  position: relative; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-close {
  position: absolute; top: 8px; right: 8px; width: 34px; height: 34px;
  background: transparent; border: none; font-size: 1.4rem; cursor: pointer; color: var(--ink-soft);
  border-radius: 50%; z-index: 10; line-height: 1;
}
.modal-close:hover { background: var(--linen-warm); }
.modal h2 { margin: 0 0 1rem; }
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }

/* ------ Toast ------ */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: var(--indigo-deep); color: var(--linen); padding: .8rem 1.4rem;
  border-radius: 999px; font-weight: 600; z-index: 200; box-shadow: 0 6px 20px rgba(0,0,0,.3);
  animation: toast-in .3s ease-out;
}
.toast[hidden] { display: none; }
.toast.err { background: #a33b2e; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ------ Tableaux ------ */
.table-wrap { overflow-x: auto; margin: 1rem 0; }
.table {
  width: 100%; border-collapse: collapse; background: var(--paper);
  border-radius: 10px; overflow: hidden;
}
.table th, .table td { padding: .7rem .8rem; text-align: left; border-bottom: 1px solid var(--thread); }
.table th { background: var(--linen-warm); font-weight: 700; font-size: .82rem; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--linen); }

/* ------ Footer ------ */
.footer { margin-top: 3rem; background: var(--indigo-deep); color: #ccd1e6; text-align: center; }
.footer p { padding: 1.2rem 1rem 1.5rem; font-size: .85rem; }
.footer-weave {
  height: 8px;
  background: repeating-linear-gradient(90deg,
    var(--terracotta) 0 24px, var(--ocre) 24px 48px, var(--sauge) 48px 72px, var(--indigo) 72px 96px);
}

/* ------ Switcher de démo (barre flottante) ------ */
.demo-switcher {
  position: fixed; left: 12px; bottom: 12px; z-index: 90;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
}
.demo-switcher.collapsed { pointer-events: auto; }
.demo-switcher-toggle {
  align-self: flex-start; background: var(--indigo-deep); color: #fff; border: none;
  width: 42px; height: 42px; border-radius: 50%; font-size: 1.1rem; cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  opacity: .8;
}
.demo-switcher-toggle:hover { opacity: 1; }
.demo-switcher.collapsed .demo-switcher-toggle::after { content: "démo"; margin-left: .3rem; font-size: .7rem; }
.demo-switcher-inner {
  background: rgba(255,255,255,.98); backdrop-filter: blur(10px);
  border: 1px solid var(--thread); border-radius: 14px; padding: .8rem;
  display: flex; flex-direction: column; gap: 4px; min-width: 200px;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
}
.demo-switcher.collapsed .demo-switcher-inner { display: none; }
.demo-switcher-title {
  font-family: var(--font-display); font-size: .9rem; font-weight: 700;
  color: var(--indigo-deep); margin-bottom: .4rem; padding: 0 .3rem;
}
.demo-role {
  display: flex; align-items: center; gap: .5rem;
  background: transparent; border: 1.5px solid var(--thread); color: var(--ink);
  padding: .45rem .8rem; border-radius: 8px; cursor: pointer;
  font: 500 .88rem var(--font-body); text-align: left;
  transition: all .12s;
}
.demo-role::before { content: attr(data-icon); font-size: 1.1rem; }
.demo-role:hover { border-color: var(--terracotta); background: var(--linen); }
.demo-role.active {
  background: var(--indigo-deep); color: #fff; border-color: var(--indigo-deep);
}
.demo-switcher-hint {
  font-size: .68rem; color: var(--ink-soft); padding: .4rem .3rem 0;
  text-align: center; line-height: 1.4;
}

/* ------ Agenda ------ */
.agenda-day { margin-bottom: 1.4rem; }
.agenda-day-title {
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 600;
  color: var(--indigo-deep); border-bottom: 2px solid var(--thread);
  padding-bottom: .3rem; margin: 0 0 .6rem;
}
.agenda-day-title.today { color: var(--terracotta); border-color: var(--terracotta); }
.agenda-item {
  display: flex; gap: .8rem; padding: .7rem .9rem;
  background: var(--paper); border-radius: 10px; margin-bottom: .5rem;
  border-left: 4px solid var(--cat, var(--indigo));
  cursor: pointer; transition: transform .12s;
}
.agenda-item:hover { transform: translateX(2px); box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.agenda-item.past { opacity: .5; }
.agenda-time {
  min-width: 65px; font-weight: 700; color: var(--indigo-deep);
  font-variant-numeric: tabular-nums; font-size: .9rem;
}
.agenda-body { flex: 1; }
.agenda-body strong { display: block; }
.agenda-body small { color: var(--ink-soft); font-size: .78rem; }

/* ------ Petites annonces ------ */
.classified-tag {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .72rem;
  font-weight: 700; margin-right: .3rem;
}
.classified-tag.offre   { background: var(--sauge); color: #fff; }
.classified-tag.demande { background: var(--ocre); color: #fff; }
.classified-body { white-space: pre-wrap; margin: .5rem 0; }
.classified-contact {
  background: var(--linen-warm); padding: .5rem .7rem; border-radius: 8px;
  font-size: .85rem; margin-top: .3rem;
}

/* ------ Annonces officielles ------ */
.annonce {
  background: var(--paper); border: 1px solid var(--thread); border-radius: 14px;
  margin-bottom: 1.4rem; overflow: hidden;
  transition: box-shadow .2s;
}
.annonce:hover { box-shadow: 0 6px 20px rgba(45, 53, 97, .08); }
.annonce.pinned { border-color: var(--ocre); border-width: 2px; }
.annonce-cover { width: 100%; aspect-ratio: 16/6; overflow: hidden; background: #1a1e35; }
.annonce-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.annonce-inner { padding: 1.4rem 1.6rem 1.5rem; position: relative; }
.annonce-pin-badge { position: absolute; top: 14px; right: 16px; }
.annonce-title {
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 600;
  margin: 0 0 .4rem; color: var(--indigo-deep); line-height: 1.25;
}
.annonce-meta { color: var(--ink-soft); font-size: .82rem; margin-bottom: 1rem; }
.annonce-actions { display: flex; gap: .4rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--thread); }

/* ============================== Renderer riche (rc-*) ============================== */
.rich-content { color: var(--ink); line-height: 1.65; font-size: 1rem; }
.rc-p { margin: 0 0 1em; }
.rc-p:last-child { margin-bottom: 0; }

.rc-h { font-family: var(--font-display); color: var(--indigo-deep); line-height: 1.2; margin: 1.4em 0 .5em; }
.rc-h:first-child { margin-top: 0; }
.rc-h1 { font-size: 1.7rem; font-weight: 700; }
.rc-h2 { font-size: 1.35rem; font-weight: 600; padding-bottom: .3em; border-bottom: 2px solid var(--thread); }
.rc-h3 { font-size: 1.15rem; font-weight: 600; }
.rc-h4 { font-size: 1rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--terracotta); }

.rc-quote {
  border-left: 4px solid var(--terracotta);
  padding: .6em 1.1em; margin: 1em 0;
  background: #fdf3e7;
  color: var(--ink); font-style: italic;
  border-radius: 0 8px 8px 0;
}

.rc-ul, .rc-ol { margin: .5em 0 1em; padding-left: 1.6em; }
.rc-ul li, .rc-ol li { margin: .2em 0; }
.rc-ul li::marker { color: var(--terracotta); }
.rc-ol li::marker { color: var(--terracotta); font-weight: 700; }

.rc-hr {
  border: none; height: 1px; margin: 1.8em 0;
  background: linear-gradient(90deg, transparent, var(--thread), transparent);
}

.rc-link {
  color: var(--terracotta); text-decoration: underline; text-decoration-thickness: 1px;
  text-underline-offset: 2px; word-break: break-word;
}
.rc-link:hover { color: #a34e2a; text-decoration-thickness: 2px; }

.rc-code {
  background: var(--linen-warm); padding: 2px 6px; border-radius: 4px;
  font-family: 'SF Mono', ui-monospace, monospace; font-size: .9em;
  color: var(--indigo-deep);
}

.rc-content strong { color: var(--indigo-deep); }
.rich-content strong { color: var(--indigo-deep); font-weight: 700; }
.rich-content em { color: var(--terracotta); }
.rich-content del { color: var(--ink-soft); }

/* Figures / images */
.rc-figure {
  margin: 1.4em 0; border-radius: 12px; overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,.1);
}
.rc-figure img {
  width: 100%; height: auto; display: block; cursor: zoom-in;
  transition: transform .3s;
}
.rc-figure img:hover { transform: scale(1.01); }
.rc-figure figcaption {
  padding: .5em .9em; background: var(--linen-warm);
  font-size: .82rem; color: var(--ink-soft); text-align: center;
  font-style: italic;
}
.rc-inline-img {
  max-width: 100%; height: auto; border-radius: 8px; margin: .3em 0;
  cursor: zoom-in; vertical-align: middle;
}

/* Vidéos et iframes */
.rc-video { width: 100%; max-height: 500px; border-radius: 12px; margin: 1.4em 0; background: #000; }
.rc-embed {
  position: relative; aspect-ratio: 16/9; width: 100%;
  border-radius: 12px; overflow: hidden;
  margin: 1.4em 0;
  box-shadow: 0 6px 24px rgba(0,0,0,.15);
  background: #000;
}
.rc-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }

/* Lightbox pour cliquer une image */
.rc-lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.92);
  display: flex; align-items: center; justify-content: center;
  z-index: 300; cursor: zoom-out; padding: 2rem;
  animation: rc-lightbox-in .2s ease-out;
}
.rc-lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.rc-lightbox-close {
  position: absolute; top: 20px; right: 20px; width: 44px; height: 44px;
  background: rgba(255,255,255,.15); color: #fff; border: none; border-radius: 50%;
  font-size: 1.5rem; cursor: pointer; backdrop-filter: blur(8px);
}
.rc-lightbox-close:hover { background: rgba(255,255,255,.3); }
@keyframes rc-lightbox-in { from { opacity: 0; } to { opacity: 1; } }

/* ============================== Éditeur WYSIWYG ============================== */
.wysiwyg {
  border: 1.5px solid var(--thread); border-radius: 12px; overflow: hidden;
  background: var(--paper); transition: border-color .15s, box-shadow .15s;
}
.wysiwyg:focus-within { border-color: var(--terracotta); box-shadow: 0 0 0 3px rgba(190,91,51,.12); }
.wysiwyg-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: .5rem .6rem; background: var(--linen-warm);
  border-bottom: 1px solid var(--thread);
  position: sticky; top: 0; z-index: 1;
}
.wysiwyg-toolbar button {
  background: transparent; border: none; padding: 4px 10px; min-width: 32px; height: 32px;
  border-radius: 6px; cursor: pointer; color: var(--ink);
  font: inherit; font-size: .9rem;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.wysiwyg-toolbar button:hover { background: rgba(0,0,0,.08); }
.wysiwyg-toolbar button.active { background: var(--indigo-deep); color: #fff; }
.wysiwyg-toolbar button code { font-size: .8rem; }

.emoji-popover {
  position: absolute; top: 100%; right: 6px; margin-top: 4px;
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
  background: var(--paper); border: 1.5px solid var(--thread); border-radius: 10px;
  padding: .5rem; box-shadow: 0 8px 24px rgba(0,0,0,.18);
  max-width: min(300px, 90vw); max-height: 220px; overflow-y: auto; z-index: 5;
}
.emoji-chip {
  background: transparent; border: none; border-radius: 6px; cursor: pointer;
  font-size: 1.15rem; line-height: 1; padding: 6px; min-width: 32px; min-height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.emoji-chip:hover, .emoji-chip:focus-visible { background: rgba(0,0,0,.08); }
@media (max-width: 480px) {
  .emoji-popover { grid-template-columns: repeat(6, 1fr); right: 0; left: 0; margin: 4px auto 0; }
}

.wysiwyg-editor {
  min-height: 240px; max-height: 60vh; overflow-y: auto;
  padding: 1.2rem 1.4rem;
  font: 15px/1.65 var(--font-body);
  color: var(--ink); outline: none;
  cursor: text;
}
.wysiwyg-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-soft); opacity: .6; font-style: italic;
  pointer-events: none;
}
.wysiwyg-editor.drop-hover {
  background: #fdf3e7;
  box-shadow: inset 0 0 0 3px var(--terracotta);
}
/* L'éditeur applique déjà la classe .rich-content donc le style des blocs (h1, blockquote, etc.)
   est identique au rendu final. C'est le principe même du WYSIWYG. */
.wysiwyg-editor > *:first-child { margin-top: 0; }
.wysiwyg-editor > *:last-child { margin-bottom: 0; }

/* ============================== Éditeur riche (ancien, markdown-only) ============================== */
.rich-editor {
  border: 1.5px solid var(--thread); border-radius: 10px; overflow: hidden;
  background: var(--paper); transition: border-color .15s;
}
.rich-editor:focus-within { border-color: var(--terracotta); box-shadow: 0 0 0 3px rgba(190,91,51,.12); }
.rich-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: .4rem .5rem; background: var(--linen-warm);
  border-bottom: 1px solid var(--thread);
}
.rich-toolbar button {
  background: transparent; border: none; padding: 4px 8px; min-width: 30px; height: 30px;
  border-radius: 6px; cursor: pointer; color: var(--ink);
  font: inherit; font-size: .88rem;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.rich-toolbar button:hover { background: rgba(0,0,0,.08); }
.rich-toolbar button.active { background: var(--indigo-deep); color: #fff; }
.rich-toolbar button code { font-size: .78rem; }
.rich-sep { width: 1px; height: 20px; background: var(--thread); margin: 0 4px; }

.rich-textarea {
  width: 100%; border: none !important; padding: .8rem 1rem;
  font: 15px/1.6 var(--font-body); background: transparent;
  resize: vertical; min-height: 140px; outline: none;
  box-shadow: none !important;
}
.rich-textarea.drop-hover {
  background: #fdf3e7;
  outline: 3px dashed var(--terracotta); outline-offset: -6px;
}

.rich-preview {
  padding: 1rem 1.2rem; background: #fdfaf3;
  border-top: 1px dashed var(--thread);
  max-height: 400px; overflow-y: auto;
}

.hint { color: var(--ink-soft); font-size: .78rem; line-height: 1.5; }
.hint code {
  background: var(--linen-warm); padding: 1px 6px; border-radius: 3px;
  font-family: 'SF Mono', monospace; font-size: .82rem;
}

/* Cover image picker */
.cover-picker { display: flex; flex-direction: column; gap: .5rem; }
.cover-preview {
  width: 100%; aspect-ratio: 16/6; border-radius: 10px;
  background: var(--linen); border: 1px dashed var(--thread);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft); font-style: italic; overflow: hidden;
}
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-actions { display: flex; gap: .4rem; }

/* Modale large pour l'éditeur d'annonce */
.modal.modal-large { width: min(780px, 96vw); }

/* ============================== Matrice d'appartenance (groupes × utilisateurs) ============================== */
.memb-matrix-wrap { overflow-x: auto; }
.memb-matrix {
  border-collapse: collapse; min-width: 100%;
  font-size: .88rem;
}
.memb-matrix th, .memb-matrix td {
  border: 1px solid var(--thread); padding: .5rem .7rem;
  text-align: center; vertical-align: middle;
}
/* En-têtes de colonnes : texte horizontal, compact, aligné en bas et replié sur
   quelques lignes — lisible sans tourner la tête (fini le texte renversé). */
.memb-matrix th {
  background: var(--linen-warm); color: var(--indigo-deep);
  font-weight: 700; letter-spacing: .01em;
  font-size: .76rem; line-height: 1.2;
  vertical-align: bottom; text-align: center;
  width: 74px; min-width: 74px; max-width: 74px;
  white-space: normal; word-break: break-word; hyphens: auto;
  padding: .6rem .4rem;
}
.memb-matrix th.corner {
  text-align: left; vertical-align: bottom; padding: .7rem 1rem;
  width: auto; min-width: 0; max-width: none; font-size: .82rem;
  position: sticky; left: 0; background: var(--linen-warm); z-index: 1;
}
.memb-matrix .memb-name {
  text-align: left; padding: .6rem 1rem;
  white-space: nowrap; background: var(--paper);
  position: sticky; left: 0; z-index: 1;
}
.memb-matrix .memb-name strong { display: block; font-size: .9rem; }
.memb-matrix .memb-name small { color: var(--ink-soft); font-size: .74rem; }
.memb-cell {
  cursor: pointer;
  width: 42px; height: 42px;
  transition: background .12s;
  color: var(--sauge); font-weight: 700; font-size: 1.1rem;
}
.memb-cell:hover { background: var(--linen); }
.memb-cell.in { background: #eaf5ed; color: var(--sauge); }
.memb-cell.in.admin { background: #fdf3e7; color: var(--terracotta); font-size: 1.3rem; }

/* ============================== Audit des canaux (admin) ============================== */
.admin-block {
  background: var(--paper); border: 1px solid var(--thread); border-radius: 12px;
  padding: 1.4rem 1.6rem;
}
.admin-block > h3 {
  margin: 0 0 1rem; font-family: var(--font-display); font-size: 1.2rem;
  color: var(--indigo-deep);
}
.channel-audit-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: .8rem;
}
.audit-card {
  border: 2px solid var(--thread); border-radius: 10px;
  padding: .9rem 1rem; background: var(--paper);
  display: flex; flex-direction: column; gap: .5rem;
}
.audit-card.status-ok      { border-color: var(--sauge); background: #eaf5ed; }
.audit-card.status-configured { border-color: var(--ocre); background: #fdf3e7; }
.audit-card.status-auth-error { border-color: #a33b2e; background: #fce8e4; }
.audit-card.status-network-error { border-color: #a33b2e; }
.audit-card header {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
}
.audit-icon { font-size: 1.3rem; }
.audit-status {
  margin-left: auto; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft);
}
.audit-details {
  font-size: .82rem; color: var(--ink); line-height: 1.5;
  display: flex; flex-direction: column; gap: 2px;
}
.audit-details .ad-k { color: var(--ink-soft); font-weight: 600; }
.audit-details .ad-v { color: var(--ink); font-family: 'SF Mono', monospace; font-size: .82rem; word-break: break-word; }
.audit-card footer { display: flex; justify-content: flex-end; padding-top: .4rem; border-top: 1px dashed var(--thread); }

/* ============================== Mon espace ============================== */
.mon-espace { max-width: 780px; margin: 0 auto; }
.me-hero {
  display: flex; align-items: center; gap: 1.2rem;
  padding: 1.5rem 1.8rem; margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--linen-warm) 0%, var(--paper) 100%);
  border: 1px solid var(--thread); border-radius: 16px;
}
.me-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--terracotta); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 2rem; font-weight: 700;
  box-shadow: 0 4px 12px rgba(190, 91, 51, .25);
  flex-shrink: 0;
}
/* Menu de sections : liste verticale lisible (fini la barre d'onglets qui défile
   horizontalement et cache la moitié des entrées). Sur grand écran, le menu devient
   une colonne latérale et le contenu s'affiche à côté. */
.me-layout { display: block; }
.me-menu { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1.4rem; }
.me-tab {
  display: flex; align-items: center; gap: .9rem; width: 100%;
  background: var(--paper); border: 1px solid var(--thread); border-radius: 12px;
  padding: .85rem 1rem; cursor: pointer; text-align: left;
  font: inherit; color: var(--ink);
  transition: border-color .15s, background .15s, transform .1s;
}
.me-tab:hover { border-color: var(--terracotta); background: var(--linen-warm); }
.me-tab:active { transform: scale(.995); }
.me-tab.active { border-color: var(--terracotta); background: var(--linen-warm); }
.me-tab .mmi-ico { font-size: 1.4rem; line-height: 1; flex: none; width: 1.9rem; text-align: center; }
.me-tab .mmi-txt { display: flex; flex-direction: column; gap: .1rem; flex: 1; min-width: 0; }
.me-tab .mmi-txt strong { font-size: .98rem; font-weight: 700; }
.me-tab .mmi-txt small { color: var(--ink-soft); font-size: .8rem; }
.me-tab .mmi-arrow { color: var(--ink-soft); font-size: 1.3rem; flex: none; }
.me-tab.active .mmi-arrow { color: var(--terracotta); }

.me-back {
  display: none; background: transparent; border: none; cursor: pointer;
  color: var(--indigo-deep); font: inherit; font-weight: 600; font-size: .92rem;
  padding: .4rem 0; margin-bottom: .8rem;
}
.me-back:hover { color: var(--terracotta); }
.me-panel { display: none; }
.me-panel.active { display: block; }
.me-panel h2 { margin-top: 0; }

/* Mobile : une seule chose à la fois — le menu, PUIS la section choisie. */
@media (max-width: 859px) {
  .me-layout.panel-open .me-menu { display: none; }
  .me-layout:not(.panel-open) .me-panels { display: none; }
  .me-layout.panel-open .me-back { display: block; }
}
/* Grand écran : menu latéral permanent + contenu à droite. */
@media (min-width: 860px) {
  .mon-espace { max-width: 1040px; }
  .me-layout { display: grid; grid-template-columns: 280px 1fr; gap: 1.8rem; align-items: start; }
  .me-menu { margin-bottom: 0; position: sticky; top: 1rem; }
  .me-back { display: none !important; }
}

.notif-choice { display: flex; flex-direction: column; gap: .5rem; }
.notif-opt {
  display: flex; align-items: center; gap: .8rem;
  padding: .8rem 1rem; border: 1.5px solid var(--thread); border-radius: 10px;
  cursor: pointer; background: var(--paper);
  transition: border-color .15s, background .15s;
}
.notif-opt:hover { border-color: var(--sauge); background: var(--linen); }
.notif-opt:has(input:checked) { border-color: var(--sauge); background: #eaf5ed; }
.notif-opt input { flex-shrink: 0; width: 20px; height: 20px; accent-color: var(--sauge); }
.notif-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.notif-body small { color: var(--ink-soft); font-size: .82rem; line-height: 1.4; }

.channel-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .5rem; }
.channel-opt.not-configured { opacity: .6; }
.channel-opt.not-configured::after {
  content: 'clé API à ajouter'; position: absolute; bottom: 4px; right: 8px;
  font-size: .62rem; color: var(--ink-soft); font-style: italic;
}
.channel-opt { position: relative; }
.ch-online {
  display: inline-block; color: var(--sauge); font-size: 1.6em; line-height: 0;
  vertical-align: middle; margin-left: 2px;
  filter: drop-shadow(0 0 3px rgba(125, 155, 124, .8));
}
.linked-badge {
  display: flex; align-items: center; gap: .5rem; padding: .5rem .8rem;
  background: #eaf5ed; border: 1.5px solid var(--sauge); border-radius: 10px;
  color: var(--ink); font-size: .9rem;
}
.linked-badge strong { color: var(--indigo-deep); }
.linked-badge .btn-small.ghost { margin-left: auto; }
.btn-small.ghost {
  background: transparent; border: 1px solid var(--thread);
  padding: 3px 10px; border-radius: 6px; font-size: .78rem; cursor: pointer;
  color: var(--ink-soft);
}
.btn-small.ghost:hover { border-color: var(--terracotta); color: var(--terracotta); }
.channel-opt {
  display: flex; align-items: center; gap: .7rem;
  padding: .8rem 1rem; border: 2px solid var(--thread); border-radius: 12px;
  cursor: pointer; background: var(--paper);
  transition: all .15s;
}
.channel-opt:hover { background: var(--linen); }
.channel-opt.selected {
  border-color: var(--terracotta); background: #fdf3e7;
  box-shadow: 0 4px 12px rgba(190, 91, 51, .15);
}
.ch-icon { font-size: 1.6rem; flex-shrink: 0; }
.ch-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; overflow: hidden; }
.ch-body strong { font-size: .95rem; }
.ch-body small { color: var(--ink-soft); font-size: .78rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 720px) {
  .channel-choice { grid-template-columns: 1fr; }
  .me-hero { flex-direction: column; text-align: center; }
}

/* ------ Locaux enrichis (cartes avec photo de couverture) ------ */
.room-card { padding: 0; overflow: hidden; }
.room-card .card-cover, .room-card .card-cover-placeholder, .room-card .card-cover-coming {
  aspect-ratio: 16/10; overflow: hidden;
}
.room-card .card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.room-card .card-cover-placeholder {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--linen-warm) 0%, var(--linen) 100%);
  font-size: 3rem; opacity: .5;
}
.room-card .card-cover-coming {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem;
  background:
    repeating-linear-gradient(45deg, #f4efe6 0 12px, #ece6d9 12px 24px);
  color: var(--ink-soft);
}
.room-card .card-cover-coming .coming-icon { font-size: 2.6rem; }
.room-card .card-cover-coming .coming-label {
  font-family: var(--font-display); font-weight: 700; font-size: 1rem;
  letter-spacing: .02em; color: var(--terracotta);
}
.badge.coming {
  background: #fbeee5; color: var(--terracotta); border: 1px solid var(--terracotta);
}
.room-card.is-coming { opacity: .95; }
.carousel-coming {
  aspect-ratio: 16/10; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .5rem;
  background: repeating-linear-gradient(45deg, #f4efe6 0 14px, #ece6d9 14px 28px);
  border-radius: 12px; color: var(--ink-soft); text-align: center; padding: 1rem;
}
.carousel-coming .coming-icon { font-size: 3rem; }
.carousel-coming strong {
  font-family: var(--font-display); font-size: 1.3rem; color: var(--terracotta);
}
.carousel-coming .coming-sub { font-size: .9rem; max-width: 320px; }
.room-card .card-body { padding: 1rem 1.2rem 1.1rem; display: flex; flex-direction: column; gap: .4rem; }
.room-card { cursor: pointer; }

.feature-chip {
  display: inline-block; padding: 2px 8px; margin: 1px 3px 1px 0;
  border-radius: 999px; background: var(--linen-warm); font-size: .72rem; color: var(--ink-soft);
  font-weight: 600;
}
.features-line { display: flex; flex-wrap: wrap; }
.features-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .4rem;
}
.feature-check {
  display: flex; align-items: center; gap: .4rem;
  padding: .4rem .6rem; border: 1px solid var(--thread); border-radius: 8px;
  cursor: pointer; font-size: .88rem; background: var(--paper);
}
.feature-check:has(input:checked) {
  border-color: var(--terracotta); background: #fdf3e7;
}

/* Carrousel photos dans la fiche */
.carousel {
  position: relative; width: 100%; aspect-ratio: 16/10;
  border-radius: 12px; overflow: hidden; background: #1a1e35;
}
.carousel-viewport { width: 100%; height: 100%; position: relative; }
.carousel-viewport img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity .35s;
}
.carousel-viewport img.active { opacity: 1; }
.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.5); color: #fff; font-size: 1.3rem; cursor: pointer; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
}
.carousel-btn:hover { background: rgba(0,0,0,.75); }
.carousel-btn.prev { left: 8px; }
.carousel-btn.next { right: 8px; }
.carousel-dots {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; z-index: 2;
}
.carousel-dots .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,.5); cursor: pointer; transition: all .18s;
}
.carousel-dots .dot.active { background: #fff; transform: scale(1.3); }

/* Mini-plan dans la fiche */
.mini-plan {
  position: relative; margin: 1rem 0; aspect-ratio: 2400/1697;
  border-radius: 10px; overflow: hidden; cursor: pointer; border: 1px solid var(--thread);
  background: #f7f2e8;
}
.mini-plan img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .95; }
.mini-plan-pin {
  position: absolute; width: 22px; height: 22px; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--terracotta); border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
  animation: pin-pulse 1.8s ease-in-out infinite;
  pointer-events: none;
}
.mini-plan-pin.admin { animation: none; }
@keyframes pin-pulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(0,0,0,.4), 0 0 0 0 rgba(190,91,51,.5); }
  50%      { box-shadow: 0 2px 8px rgba(0,0,0,.4), 0 0 0 12px rgba(190,91,51,0); }
}
.mini-plan-hint {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(255,255,255,.95); color: var(--indigo-deep);
  padding: 4px 10px; border-radius: 6px; font-size: .78rem; font-weight: 600;
}

/* Prochains créneaux */
.room-schedule h4 { margin: 0 0 .5rem; }
.schedule-item {
  display: flex; align-items: center; gap: .8rem;
  padding: .5rem .7rem; border-radius: 8px;
  background: #fdf3e7; border-left: 3px solid var(--terracotta);
  margin-bottom: .3rem; font-size: .88rem;
}
.schedule-item.event { border-left-color: var(--sauge); background: #eaf5ed; }
.rs-date {
  min-width: 100px; font-weight: 600; color: var(--indigo-deep);
  font-variant-numeric: tabular-nums;
}
.rs-date small { display: block; font-weight: 400; color: var(--ink-soft); font-size: .74rem; }
.rs-title em { color: var(--ink-soft); font-style: normal; font-size: .72rem; }

/* Photos admin */
.room-photos-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .5rem; margin: .3rem 0;
}
.photo-tile {
  position: relative; aspect-ratio: 4/3; border-radius: 8px; overflow: hidden;
  border: 2px solid var(--thread); background: var(--linen);
}
.photo-tile.cover { border-color: var(--terracotta); }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-badge {
  position: absolute; top: 5px; left: 5px;
  background: var(--terracotta); color: #fff; padding: 2px 8px; border-radius: 4px;
  font-size: .8rem; font-weight: 700;
}
.photo-actions {
  position: absolute; top: 5px; right: 5px; display: flex; gap: 3px;
  opacity: 0; transition: opacity .15s;
}
.photo-tile:hover .photo-actions { opacity: 1; }

/* Mini placer admin — mode point + polygone */
.placer-mode-choice { display: flex; gap: .4rem; margin-bottom: .5rem; flex-wrap: wrap; align-items: center; }
.pm-btn {
  background: transparent; border: 1.5px solid var(--thread); color: var(--ink);
  padding: .4rem .9rem; border-radius: 999px; cursor: pointer;
  font: 500 .85rem var(--font-body); transition: all .12s;
}
.pm-btn:hover { border-color: var(--terracotta); }
.pm-btn.active { background: var(--indigo-deep); color: #fff; border-color: var(--indigo-deep); }
.placer-hint { color: var(--ink-soft); font-size: .82rem; margin: .4rem 0 0; }
.mini-placer-canvas {
  position: relative; border: 2px solid var(--indigo-deep); border-radius: 8px;
  overflow: hidden; background: #f7f2e8;
  max-height: 65vh; cursor: grab;
}
.mini-placer-canvas.drawing { cursor: crosshair; }
.mini-placer-canvas.panning { cursor: grabbing; }
.mp-inner {
  position: absolute; inset: 0; transform-origin: 0 0; will-change: transform;
}
.mp-inner img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; display: block; user-select: none; -webkit-user-drag: none;
}
.mp-inner svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.mini-placer-canvas .mini-plan-pin { position: absolute; }

/* Contrôles de zoom */
.placer-zoom-controls {
  display: inline-flex; align-items: center; gap: 2px;
  background: #fffdf9; border: 1px solid var(--thread); border-radius: 999px;
  padding: 3px; margin-left: .3rem;
}
.pz-btn {
  width: 26px; height: 26px; border-radius: 50%; border: none; background: transparent;
  font-size: 1rem; font-weight: 700; color: var(--indigo-deep); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.pz-btn:hover { background: var(--linen-warm); }
.pz-level {
  min-width: 44px; text-align: center; font-size: .75rem; font-weight: 600;
  color: var(--ink-soft); font-variant-numeric: tabular-nums;
}
.placer-existing-poly {
  fill: rgba(45, 53, 97, .18); stroke: rgba(45, 53, 97, .8); stroke-width: 1.5px;
  stroke-linejoin: miter; vector-effect: non-scaling-stroke;
}
.placer-drawing-poly {
  fill: rgba(190, 91, 51, .28); stroke: rgba(190, 91, 51, 1); stroke-width: 2px;
  stroke-linejoin: miter; stroke-dasharray: 3 1.5;
  vector-effect: non-scaling-stroke;
  animation: dash-flow 1s linear infinite;
}
@keyframes dash-flow { to { stroke-dashoffset: -4; } }
.placer-drawing-pt {
  fill: #fff; stroke: var(--terracotta); stroke-width: 1.4px;
  vector-effect: non-scaling-stroke;
}
.placer-drawing-pt.first { fill: var(--terracotta); stroke: #fff; }

/* Mini-plan public (dans la fiche du local) — polygone si dispo */
.mini-plan svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
}
.mini-plan-polygon {
  fill: rgba(190, 91, 51, .32);
  stroke: rgba(190, 91, 51, 1);
  stroke-width: 2px;
  stroke-linejoin: miter;
  vector-effect: non-scaling-stroke;
  animation: mini-poly-pulse 2s ease-in-out infinite;
}
@keyframes mini-poly-pulse {
  0%, 100% { fill: rgba(190, 91, 51, .28); }
  50%      { fill: rgba(190, 91, 51, .48); }
}

/* Choix d'ambiance sonore */
.ambiance-choice {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem;
}
.ambiance-opt {
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem; border: 2px solid var(--thread); border-radius: 10px;
  background: var(--paper); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.ambiance-opt:hover { background: var(--linen); }
.ambiance-opt.selected {
  border-color: var(--terracotta); background: #fdf3e7;
}
.amb-icon { font-size: 1.5rem; }
.amb-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.amb-body strong { font-size: .88rem; }
.amb-body small { color: var(--ink-soft); font-size: .72rem; line-height: 1.3; }
@media (max-width: 720px) { .ambiance-choice { grid-template-columns: 1fr; } }

/* Page Plan publique */
.floor-switch {
  display: inline-flex; background: var(--linen-warm); padding: 3px; border-radius: 999px; gap: 3px;
}
.floor-switch button {
  border: none; background: transparent; padding: .4rem 1rem; border-radius: 999px;
  cursor: pointer; font-weight: 600; color: var(--ink); font-size: .88rem;
}
.floor-switch button.active { background: var(--indigo-deep); color: #fff; }
.plan-canvas {
  position: relative; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--thread); background: #f7f2e8;
  max-height: 78vh;
}
.plan-canvas img { width: 100%; height: 100%; object-fit: contain; display: block; }
.plan-marker {
  position: absolute; transform: translate(-50%, -50%);
  background: transparent; border: none; cursor: pointer; padding: 0;
  display: flex; flex-direction: column; align-items: center;
}
.pm-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--sauge); border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  transition: transform .18s;
}
.plan-marker.private .pm-dot { background: var(--terracotta); }
.pm-label {
  position: absolute; top: 100%; margin-top: 4px;
  background: rgba(45,53,97,.96); color: #faf7f2;
  padding: 3px 8px; border-radius: 6px; font-size: .74rem; font-weight: 600;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s;
  z-index: 3;
}
.plan-marker:hover .pm-dot { transform: scale(1.35); }
.plan-marker:hover .pm-label { opacity: 1; }

/* ============================== Forum (hub) ============================== */
.forum-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.4rem;
}
.forum-title {
  font-family: var(--font-display); font-size: 2rem; font-weight: 700;
  margin: 0; color: var(--indigo-deep); line-height: 1.1;
}
.forum-lead { margin: .3rem 0 0; color: var(--ink-soft); font-size: 1rem; }

.forum-nav {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: .8rem; margin-bottom: 2rem;
}
.forum-nav-btn {
  display: flex; align-items: center; gap: .9rem;
  padding: 1rem 1.2rem;
  background: var(--paper); border: 2px solid var(--thread); border-radius: 14px;
  cursor: pointer; text-align: left; font: inherit; color: var(--ink);
  transition: all .18s;
  position: relative;
}
.forum-nav-btn:hover {
  border-color: var(--terracotta);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(45, 53, 97, .08);
}
.forum-nav-btn.active {
  border-color: var(--terracotta); background: #fdf3e7;
  box-shadow: 0 6px 20px rgba(190, 91, 51, .18);
}
.fnb-icon { font-size: 2rem; flex-shrink: 0; line-height: 1; }
.fnb-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.fnb-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; color: var(--indigo-deep); }
.fnb-sub { font-size: .82rem; color: var(--ink-soft); }
.fnb-count {
  padding: 4px 10px; border-radius: 999px;
  background: var(--linen-warm); color: var(--ink-soft);
  font-size: .78rem; font-weight: 700;
  min-width: 32px; text-align: center;
}
.forum-nav-btn.active .fnb-count { background: var(--terracotta); color: #fff; }

/* Barre d'outils petites annonces / forum */
.cls-toolbar {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.4rem; flex-wrap: wrap;
}
.cls-filters { display: flex; gap: .4rem; flex-wrap: wrap; flex: 1; }
.cls-filter {
  background: transparent; border: 1.5px solid var(--thread);
  padding: .45rem 1rem; border-radius: 999px; cursor: pointer;
  font: 600 .88rem var(--font-body); color: var(--ink);
  display: inline-flex; align-items: center; gap: .4rem;
  transition: all .15s;
}
.cls-filter:hover { border-color: var(--terracotta); color: var(--terracotta); }
.cls-filter.active {
  background: var(--indigo-deep); color: #fff; border-color: var(--indigo-deep);
}
.cls-count {
  background: rgba(0,0,0,.1); color: inherit; padding: 1px 8px; border-radius: 999px;
  font-size: .75rem; font-weight: 700; min-width: 22px; text-align: center;
}
.cls-filter.active .cls-count { background: rgba(255,255,255,.25); }

/* Grille de petites annonces */
.cls-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}
.cls-card {
  background: var(--paper); border: 1px solid var(--thread); border-radius: 12px;
  padding: 1.1rem 1.2rem 1rem;
  display: flex; flex-direction: column; gap: .5rem;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  position: relative; overflow: hidden;
}
.cls-card::before {
  content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 3px;
}
.cls-card.offre::before   { background: linear-gradient(90deg, var(--sauge), #a7c4a5); }
.cls-card.demande::before { background: linear-gradient(90deg, var(--ocre), #dbb85a); }
.cls-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(45, 53, 97, .1);
}
.cls-card-head { display: flex; justify-content: space-between; align-items: center; }
.cls-badge {
  padding: 3px 10px; border-radius: 999px; font-size: .72rem; font-weight: 700;
  color: #fff; letter-spacing: .02em;
}
.cls-badge.offre   { background: var(--sauge); }
.cls-badge.demande { background: var(--ocre); }
.cls-date { color: var(--ink-soft); font-size: .78rem; font-variant-numeric: tabular-nums; }
.cls-title {
  font-family: var(--font-display); font-size: 1.15rem; font-weight: 600;
  color: var(--indigo-deep); margin: 0; line-height: 1.3;
}
.cls-body { color: var(--ink); font-size: .92rem; }
.cls-body .rc-p { margin: .3em 0; }
.cls-contact {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--linen-warm); padding: .4rem .7rem; border-radius: 8px;
  font-size: .85rem; font-weight: 500; color: var(--indigo-deep);
  margin-top: .3rem; align-self: flex-start;
}
.cls-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: .5rem; margin-top: auto;
  border-top: 1px dashed var(--thread);
}
.cls-author { color: var(--ink-soft); font-size: .82rem; }
.cls-actions { display: flex; gap: .3rem; }
.cls-action-btn {
  background: transparent; border: none; padding: 4px 8px; border-radius: 6px;
  cursor: pointer; font-size: .95rem; color: var(--ink-soft);
  transition: all .12s;
}
.cls-action-btn:hover { background: var(--linen-warm); color: var(--ink); }
.cls-action-btn.danger:hover { background: #a33b2e; color: #fff; }

/* En-tête d'un groupe (Forum) */
.group-header {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.2rem 1.4rem; margin-bottom: 1.2rem;
  background: linear-gradient(135deg, var(--linen-warm) 0%, var(--paper) 100%);
  border: 1px solid var(--thread); border-radius: 14px;
}
.group-header-icon {
  font-size: 2.4rem; width: 60px; height: 60px;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper); border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.subcats-strip {
  display: flex; flex-wrap: wrap; gap: .5rem;
  padding: .6rem 0; margin-bottom: .8rem;
  border-bottom: 1px dashed var(--thread);
}
.subcat-btn {
  background: var(--paper); border: 1.5px solid var(--thread);
  padding: .4rem 1rem; border-radius: 999px; cursor: pointer;
  font: 500 .85rem var(--font-body); color: var(--ink);
  display: inline-flex; align-items: center; gap: .3rem;
  transition: all .15s;
}
.subcat-btn:hover { border-color: var(--terracotta); color: var(--terracotta); }

/* Liste de sujets forum interne */
.topic-list {
  display: flex; flex-direction: column; gap: .5rem;
}
.topic-row {
  display: flex; align-items: center; gap: 1rem;
  padding: .9rem 1.1rem;
  background: var(--paper); border: 1px solid var(--thread); border-radius: 10px;
  cursor: pointer; transition: all .15s;
}
.topic-row:hover {
  border-color: var(--terracotta);
  transform: translateX(3px);
  box-shadow: 0 4px 12px rgba(0,0,0,.05);
}
.topic-icon {
  font-size: 1.4rem; width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--linen-warm); border-radius: 50%; flex-shrink: 0;
}
.topic-body { flex: 1; min-width: 0; }
.topic-title {
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 600;
  color: var(--indigo-deep); margin-bottom: 2px;
}
.topic-meta { color: var(--ink-soft); font-size: .82rem; }
.topic-count {
  display: flex; flex-direction: column; align-items: center;
  padding: 0 .6rem; min-width: 60px;
}
.topic-count strong {
  font-family: var(--font-display); font-size: 1.4rem; color: var(--terracotta);
  line-height: 1;
}
.topic-count span { font-size: .7rem; color: var(--ink-soft); }

@media (max-width: 720px) {
  .forum-nav { grid-template-columns: 1fr; }
  .cls-grid { grid-template-columns: 1fr; }
  .cls-toolbar { flex-direction: column; align-items: stretch; }
}

/* ------ Forum ------ */
.forum-list .card-meta { margin-bottom: 0; }
.forum-post {
  background: var(--paper); border: 1px solid var(--thread); border-radius: 10px;
  padding: .9rem 1.1rem; margin-bottom: .8rem;
}
.forum-post-head {
  display: flex; align-items: center; gap: .6rem;
  font-size: .82rem; color: var(--ink-soft); margin-bottom: .4rem;
}
.forum-post-body { white-space: pre-wrap; }

@media (max-width: 720px) {
  .field-row { grid-template-columns: 1fr; }
  .masthead-inner { flex-wrap: wrap; }
  .nav { order: 3; width: 100%; margin-left: 0; gap: .8rem; font-size: .9rem; flex-wrap: wrap; overflow: visible; }
  .demo-switcher { left: 8px; bottom: 72px; right: auto; }
  .hero h1 { font-size: 1.9rem; }
  h1 { font-size: 1.9rem; }
}

/* ---- Cartes statistiques (admin communication) ---- */
.stat-card {
  background: #fdfaf5;
  border: 1px solid var(--thread);
  border-radius: 10px;
  padding: .8rem 1.1rem;
  min-width: 120px;
  text-align: center;
}
.stat-num { font-family: 'Fraunces', serif; font-size: 1.6rem; font-weight: 600; line-height: 1.2; }
.stat-lbl { color: var(--ink-soft); font-size: .8rem; margin-top: .2rem; }

/* ---- Onglets admin ---- */
.admin-tabs {
  display: flex;
  gap: .3rem;
  border-bottom: 2px solid var(--thread);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab {
  background: transparent;
  border: none;
  padding: .8rem 1.2rem;
  font-family: inherit;
  font-size: .95rem;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  border-bottom: 3px solid transparent;
  transform: translateY(2px);
  transition: color .15s, background .15s, border-color .15s;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  white-space: nowrap;
  font-weight: 500;
}
.admin-tab:hover { color: var(--ink); background: #f4efe6; }
.admin-tab.active {
  color: var(--terracotta);
  border-bottom-color: var(--terracotta);
  font-weight: 600;
}
.admin-tab .at-icon { font-size: 1.1em; }
.admin-tab .at-badge {
  background: var(--terracotta);
  color: #fff;
  font-size: .7rem;
  padding: .1rem .5rem;
  border-radius: 999px;
  font-weight: 600;
  min-width: 1.2rem;
  text-align: center;
}
@media (max-width: 640px) {
  .admin-tab .at-label { display: none; }
  .admin-tab { padding: .7rem .9rem; }
}

/* ---- Switcher démo : feedback visuel ---- */
.demo-role { position: relative; transition: opacity .15s, background .15s; }
.demo-role.switching {
  opacity: .5;
  pointer-events: none;
}
.demo-role.switching::after {
  content: "…";
  position: absolute;
  right: .5rem;
  top: 50%;
  transform: translateY(-50%);
  animation: dots 1s infinite;
}
@keyframes dots {
  0%, 20% { content: "."; }
  40% { content: ".."; }
  60%, 100% { content: "..."; }
}

/* ---- Bande "Nous contacter" en bas de l'accueil ---- */
.home-contact {
  margin: 3rem 0 1rem;
  padding: 1.6rem 1.8rem;
  background: linear-gradient(135deg, #f4efe6 0%, #ede4d3 100%);
  border-radius: 14px;
  border: 1px solid var(--thread);
}
.home-contact-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.home-contact h3 { font-family: 'Fraunces', serif; font-weight: 600; color: var(--ink); }

/* ---- Feedback de navigation : barre de chargement ---- */
#main.loading { position: relative; }
#main.loading::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--terracotta), transparent);
  background-size: 200% 100%;
  animation: nav-loading 1s linear infinite;
  z-index: 9999;
  opacity: 0;
  transition: opacity .2s;
}
#main.loading[data-slow]::before { opacity: 1; }
@keyframes nav-loading {
  0%   { background-position: -100% 0; }
  100% { background-position: 100% 0; }
}

/* ---- Bloc "Sur le forum" en accueil ---- */
.home-forum-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.home-forum-block {
  background: #fdfaf5;
  border: 1px solid var(--thread);
  border-radius: 12px;
  padding: 1rem 1.2rem;
}
.home-forum-block h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.05rem;
  margin: 0 0 .6rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.home-forum-block .see-all {
  font-family: 'Karla', sans-serif;
  font-size: .8rem;
  font-weight: 400;
  color: var(--terracotta);
  text-decoration: none;
}
.home-forum-item {
  display: block;
  padding: .5rem .6rem;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  transition: background .1s;
  margin: 0 -.6rem;
}
.home-forum-item:hover { background: #f4efe6; }
.home-forum-item strong { display: block; font-weight: 500; }
.home-forum-item small { display: block; color: var(--ink-soft); font-size: .8rem; margin-top: .1rem; }

/* ---- Vue plan public : polygones interactifs ---- */
.plan-canvas-poly { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--thread); background: #fdfaf5; }
.plan-canvas-poly > img { width: 100%; height: 100%; object-fit: contain; display: block; }
.plan-overlay {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none; /* le SVG lui-même laisse passer, mais les shapes reprennent */
}
.plan-poly {
  pointer-events: auto;
  cursor: pointer;
  transition: fill-opacity .15s, stroke-width .15s, filter .15s;
  vector-effect: non-scaling-stroke;
}
.plan-poly.shared {
  fill: var(--sauge, #7d9b7c);
  fill-opacity: .28;
  stroke: var(--sauge, #7d9b7c);
  stroke-width: 1.4;
}
.plan-poly.private {
  fill: var(--ocre, #c9a447);
  fill-opacity: .22;
  stroke: var(--ocre, #c9a447);
  stroke-width: 1.4;
}
.plan-poly:hover {
  fill-opacity: .5;
  stroke-width: 2.2;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.15));
}
.plan-labels { position: absolute; inset: 0; pointer-events: none; }
.plan-label-btn {
  position: absolute;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,.92);
  border: 1px solid var(--thread);
  padding: .18rem .5rem;
  border-radius: 999px;
  font-family: 'Karla', sans-serif;
  font-size: .78rem;
  color: var(--ink);
  cursor: pointer;
  pointer-events: auto;
  white-space: nowrap;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .1s, transform .1s;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.plan-label-btn:hover {
  background: var(--terracotta);
  color: #fff;
  transform: translate(-50%, -50%) scale(1.05);
}

/* ---- Sous-catégories forum : édition inline ---- */
.subcat-btn { position: relative; }
.subcat-btn.active { background: var(--terracotta); color: #fff; }
.subcat-btn.subcat-add {
  padding: .3rem .7rem;
  font-size: 1.1rem;
  color: var(--ink-soft);
  border-style: dashed;
}
.subcat-btn.subcat-add:hover { color: var(--terracotta); border-color: var(--terracotta); }
.subcat-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  margin-left: .3rem;
  border-radius: 50%;
  background: rgba(0,0,0,.15);
  color: #fff;
  font-size: .7rem;
  line-height: 1;
  opacity: 0;
  transition: opacity .1s, background .1s;
}
.subcat-btn:hover .subcat-del { opacity: 1; }
.subcat-del:hover { background: var(--terracotta); }

/* ---- Agenda : sélecteur de vue + semaine + mois ---- */
.agenda-view-switch {
  display: inline-flex;
  background: #f4efe6;
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.agenda-view-switch button {
  background: transparent;
  border: 0;
  padding: .4rem .9rem;
  font-family: inherit;
  font-size: .85rem;
  color: var(--ink-soft);
  border-radius: 999px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.agenda-view-switch button:hover { color: var(--ink); }
.agenda-view-switch button.active { background: #fff; color: var(--terracotta); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.agenda-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1rem;
  background: #fdfaf5; padding: .6rem 1rem; border-radius: 10px;
  border: 1px solid var(--thread);
  flex-wrap: wrap;
}
.agenda-nav strong { font-family: 'Fraunces', serif; font-size: 1.05rem; }

.agenda-chip {
  display: flex; flex-direction: column; gap: .1rem;
  padding: .45rem .6rem; border-radius: 8px;
  background: color-mix(in srgb, var(--cat, #3a4270) 8%, #fdfaf5);
  border: 1px solid color-mix(in srgb, var(--cat, #3a4270) 25%, transparent);
  border-left: 4px solid var(--cat, #3a4270);
  min-width: 0;
  font-size: .78rem; cursor: pointer;
  transition: transform .08s, box-shadow .12s;
  overflow: hidden;
}
.agenda-chip.is-cancelled .chip-title { text-decoration: line-through; opacity: .7; }
.agenda-chip.is-cancelled .chip-time { color: #999 !important; }
.month-mini-chip.is-cancelled { text-decoration: line-through; opacity: .65; }
.agenda-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0,0,0,.08);
  border-color: var(--cat, #3a4270);
}
.chip-time {
  font-family: var(--font-display); font-variant-numeric: tabular-nums;
  color: var(--cat, #3a4270); font-weight: 700; font-size: .78rem;
  white-space: nowrap; letter-spacing: .01em;
}
.chip-title {
  font-weight: 700; font-size: .82rem; color: var(--ink);
  line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Semaine */
.agenda-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: .5rem;
}
.week-day {
  background: #fdfaf5;
  border: 1px solid var(--thread);
  border-radius: 8px;
  min-height: 200px;
  display: flex; flex-direction: column;
}
.week-day.today { border-color: var(--terracotta); background: #fdf3e7; }
.week-day-head {
  padding: .5rem; text-align: center; border-bottom: 1px solid var(--thread);
  display: flex; flex-direction: column; gap: .1rem;
}
.week-day-head strong { text-transform: capitalize; font-size: .8rem; color: var(--ink-soft); }
.week-day-head span { font-family: 'Fraunces', serif; font-size: 1.2rem; }
.week-day.today .week-day-head span { color: var(--terracotta); }
.week-day-body {
  padding: .4rem; display: flex; flex-direction: column; gap: .3rem;
  flex: 1; overflow-y: auto;
}
.week-day-empty { color: var(--thread); text-align: center; font-size: .8rem; padding: 1rem 0; }
@media (max-width: 720px) {
  .agenda-week { grid-template-columns: 1fr; }
  .week-day { min-height: auto; }
}

/* Mois */
.agenda-month .month-weekdays,
.agenda-month .month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}
.month-weekdays > div {
  padding: .4rem; text-align: center; font-size: .8rem; color: var(--ink-soft);
  font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
.month-grid {
  background: var(--thread); border-radius: 8px; overflow: hidden;
  padding: 2px; gap: 2px;
}
.month-cell {
  background: #fdfaf5;
  min-height: 100px;
  min-width: 0;
  padding: .3rem;
  display: flex; flex-direction: column; gap: .2rem;
  border-radius: 4px;
}
.month-cell.empty { background: #f4efe6; }
.month-cell.today { background: #fdf3e7; }
.month-cell-day {
  font-family: 'Fraunces', serif; font-size: .95rem; font-weight: 600;
  color: var(--ink-soft);
  padding: .1rem .2rem;
}
.month-cell.today .month-cell-day { color: var(--terracotta); font-size: 1.05rem; }
.month-cell-events { display: flex; flex-direction: column; gap: .15rem; overflow: hidden; min-width: 0; }
.month-cell-events .month-mini-chip {
  display: block; padding: .18rem .4rem; border-radius: 5px;
  background: color-mix(in srgb, var(--cat, #3a4270) 12%, #fdfaf5);
  border-left: 3px solid var(--cat, #3a4270);
  font-size: .72rem; line-height: 1.3; font-weight: 700;
  color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: pointer; min-width: 0;
  transition: background .1s, transform .08s;
}
.month-cell-events .month-mini-chip:hover {
  background: color-mix(in srgb, var(--cat, #3a4270) 22%, #fdfaf5);
  transform: translateX(1px);
}
.month-more {
  font-size: .7rem; color: var(--ink-soft); font-style: italic; padding: .1rem .3rem;
  cursor: pointer; border-radius: 4px;
}
.month-more:hover { background: #f4efe6; color: var(--terracotta); font-style: normal; }
@media (max-width: 720px) {
  .month-cell { min-height: 70px; padding: .2rem; }
  .month-cell-events .month-mini-chip { font-size: .62rem; padding: .05rem .25rem; }
  .month-weekdays > div { padding: .3rem 0; font-size: .7rem; }
}

/* ---- Guide d'activation des canaux (Mon espace → Canaux) ---- */
.channel-howto {
  background: #f4efe6;
  border-radius: 10px;
  padding: .8rem 1.2rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--thread);
}
.channel-howto summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  padding: .3rem 0;
  list-style: none;
}
.channel-howto summary::-webkit-details-marker { display: none; }
.channel-howto summary::before { content: '▸ '; transition: transform .15s; display: inline-block; }
.channel-howto[open] summary::before { content: '▾ '; }
.channel-howto summary small { color: var(--ink-soft); font-weight: 400; }
.howto-inner { margin-top: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.howto-item {
  background: #fff;
  padding: .8rem 1rem;
  border-radius: 8px;
  border-left: 3px solid var(--terracotta);
}
.howto-item strong { display: block; font-size: 1rem; margin-bottom: .3rem; font-family: 'Fraunces', serif; }
.howto-item p { margin: .3rem 0; color: var(--ink); font-size: .92rem; line-height: 1.5; }
.howto-item code { background: #fdf3e7; padding: .1rem .35rem; border-radius: 4px; font-size: .85em; }

/* ---- Mini-plan zoomable (fiche local) ---- */
.mini-plan-zoomable { position: relative; }
.mini-plan-zoomable .mini-plan-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 2400 / 1697;
  overflow: hidden;
  border-radius: 8px;
  background: #fdfaf5;
  touch-action: none;
  cursor: grab;
}
.mini-plan-zoomable .mini-plan-inner {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  transition: transform .15s ease-out;
  will-change: transform;
}
.mini-plan-zoomable .mini-plan-inner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mini-plan-zoomable .mini-plan-inner svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.mini-plan-zoom-controls {
  position: absolute;
  right: .5rem; top: .5rem;
  display: flex; gap: .2rem;
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--thread);
  border-radius: 8px;
  padding: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  z-index: 3;
}
.mpz-btn {
  background: transparent;
  border: 0;
  width: 28px; height: 28px;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  color: var(--ink);
  transition: background .12s;
}
.mpz-btn:hover { background: var(--thread); }
.mini-plan-zoomable .mini-plan-hint {
  position: absolute; bottom: .5rem; right: .5rem;
  background: rgba(45, 53, 97, .85); color: #fff;
  padding: .2rem .6rem; border-radius: 6px;
  font-size: .78rem; z-index: 2;
  pointer-events: none;
}

/* ---- Bandeau formulaire de contact dans le Pilier public ---- */
.pilier-contact-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(135deg, #f4efe6 0%, #ede4d3 100%);
  border: 1px solid var(--thread);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}
.pilier-contact-cta strong {
  font-family: 'Fraunces', serif;
  font-size: 1.02rem;
  color: var(--ink);
  display: block;
}
.pilier-contact-cta p {
  margin: .2rem 0 0;
  color: var(--ink-soft);
  font-size: .9rem;
  line-height: 1.4;
}
.pilier-contact-cta > div { flex: 1; min-width: 240px; }

/* ---- Forum : posts + réponses enchâssées ---- */
.forum-post { position: relative; }
.forum-post .forum-post-head {
  display: flex;
  align-items: center;
  gap: .8rem;
  flex-wrap: wrap;
}
.forum-post.reply {
  margin-left: 2.5rem;
  padding-left: 1rem;
  border-left: 3px solid var(--thread);
  background: rgba(253, 250, 245, .5);
}
.forum-post.reply::before {
  content: '↩';
  position: absolute;
  left: -1.4rem;
  top: 1rem;
  color: var(--ink-soft);
  font-size: .9rem;
  opacity: .5;
}
.post-actions {
  margin-left: auto;
  display: flex;
  gap: .3rem;
  flex-wrap: wrap;
}
.post-action-btn {
  background: transparent;
  border: 0;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: inherit;
  font-size: .82rem;
  padding: .25rem .6rem;
  border-radius: 6px;
  transition: background .12s, color .12s;
}
.post-action-btn:hover { background: var(--terracotta); color: #fff; }
.post-action-btn.need-btn:hover { background: var(--ocre, #c9a447); }
.post-reply-btn { display: none; }
.forum-post.post-highlight { animation: post-glow 3s ease-out; transition: box-shadow 3s ease-out; }
@keyframes post-glow {
  0%   { background: #fdf3e7; box-shadow: 0 0 0 3px var(--terracotta); }
  100% { background: transparent; box-shadow: 0 0 0 0 transparent; }
}
.post-reply-slot { padding: 0; }
.post-reply-slot:not(:empty) {
  margin-top: .8rem;
  padding: .8rem 1rem;
  background: #fdfaf5;
  border-radius: 8px;
  border-left: 3px solid var(--terracotta);
}
.inline-reply-form label {
  font-size: .85rem;
  color: var(--ink-soft);
  font-weight: 500;
}
.post-form {
  padding: 1.2rem;
  background: #fdfaf5;
  border: 1px solid var(--thread);
  border-radius: 12px;
}
.post-form label {
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  color: var(--ink);
}
@media (max-width: 640px) {
  .forum-post.reply { margin-left: 1rem; padding-left: .8rem; }
  .forum-post.reply::before { display: none; }
}

/* ---- Cloche notifications ---- */
.notif-bell {
  position: relative;
  background: transparent;
  border: 0;
  padding: .35rem .5rem;
  cursor: pointer;
  border-radius: 8px;
  transition: background .12s;
  margin-right: .3rem;
}
.notif-bell:hover { background: rgba(255, 255, 255, .1); }
.notif-bell-icon { font-size: 1.15rem; display: inline-block; }
.notif-bell.has-notif .notif-bell-icon {
  animation: bell-ring 1.8s ease-in-out infinite;
  transform-origin: top center;
}
@keyframes bell-ring {
  0%, 88%, 100% { transform: rotate(0); }
  90% { transform: rotate(-14deg); }
  93% { transform: rotate(10deg); }
  96% { transform: rotate(-6deg); }
}
.notif-badge {
  position: absolute;
  top: -2px; right: -2px;
  background: var(--terracotta);
  color: #fff;
  font-size: .65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  min-width: 1.1rem;
  text-align: center;
  border: 2px solid var(--indigo-deep);
  line-height: 1;
}
.notif-section { margin-bottom: 1rem; }
.notif-list { list-style: none; padding: 0; margin: 0; }
.notif-list li { margin-bottom: .3rem; }
.notif-item {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .7rem .9rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink);
  background: #fdfaf5;
  border: 1px solid var(--thread);
  transition: background .1s, transform .1s, border-color .1s;
}
.notif-item:hover {
  background: #f4efe6;
  transform: translateX(2px);
  border-color: var(--terracotta);
}
.notif-icon { font-size: 1.4rem; flex: 0 0 auto; }
.notif-body {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0;
}
.notif-body strong { font-weight: 600; font-size: .92rem; }
.notif-body span {
  font-size: .82rem; color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.notif-arrow { color: var(--ink-soft); font-size: 1.2rem; }
.notif-urgent .notif-item { border-left: 3px solid var(--terracotta); }
.notif-attention .notif-item { border-left: 3px solid var(--ocre, #c9a447); }
.notif-item.notif-seen { opacity: .55; background: #f7f2e8; }
.notif-item.notif-seen strong { font-weight: 500; }
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--terracotta); flex: 0 0 auto;
  box-shadow: 0 0 0 2px #fdfaf5;
  align-self: center;
}

/* ------ Bloc "Messages contact" (admin, en tête de l'onglet Communication) ------ */
.contact-msg-block {
  background: #fff !important;
  border-left: 4px solid var(--terracotta);
  scroll-margin-top: 90px;
}
.notif-count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; padding: 0 .5rem;
  background: var(--terracotta); color: #fff;
  border-radius: 999px; font-size: .82rem; font-weight: 700;
  font-family: var(--font-body);
}
.contact-msg-list { display: flex; flex-direction: column; gap: .7rem; }
.contact-msg-card {
  background: #fdfaf5; border: 1px solid var(--thread);
  border-radius: 10px; padding: .9rem 1.1rem;
  transition: box-shadow .15s;
}
.contact-msg-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.contact-msg-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 1rem; flex-wrap: wrap; margin-bottom: .3rem;
}
.contact-msg-who { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.contact-msg-who strong {
  font-family: var(--font-display); font-size: 1rem; color: var(--ink);
}
.contact-msg-email {
  font-size: .82rem; color: var(--indigo-deep); text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.contact-msg-email:hover { text-decoration: underline; }
.contact-msg-meta {
  display: flex; gap: .5rem; align-items: center; color: var(--ink-soft); font-size: .78rem;
}
.contact-msg-warn {
  background: #fbe8e2; color: var(--terracotta); padding: 2px 8px; border-radius: 999px;
  font-weight: 600; font-size: .72rem;
}
.contact-msg-subject {
  font-weight: 700; font-size: .92rem; margin: .4rem 0 .3rem;
}
.contact-msg-body {
  background: #f7f2e8; padding: .7rem .9rem; border-radius: 8px;
  white-space: pre-wrap; font-size: .9rem; line-height: 1.5;
  border-left: 2px solid var(--thread);
}
.contact-msg-actions {
  display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .7rem; justify-content: flex-end;
}
.btn-small.danger-ghost {
  background: transparent; color: var(--terracotta); border: 1px solid var(--terracotta);
}
.btn-small.danger-ghost:hover { background: var(--terracotta); color: #fff; }

@keyframes block-glow {
  0% { box-shadow: 0 0 0 0 rgba(190, 91, 51, .5); }
  50% { box-shadow: 0 0 0 8px rgba(190, 91, 51, .18); }
  100% { box-shadow: 0 0 0 0 rgba(190, 91, 51, 0); }
}
.block-highlight { animation: block-glow 2.5s ease-out; }
tr.user-anon { opacity: .55; font-style: italic; }

/* ------ Barre d'onglets mobile ------ */
.mobile-nav {
  display: none; /* affichée seulement en media <720px */
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 80;
  background: var(--paper);
  border-top: 1px solid var(--thread);
  box-shadow: 0 -2px 12px rgba(0,0,0,.06);
  padding: .3rem .2rem calc(.3rem + env(safe-area-inset-bottom));
}
.mobile-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: .4rem .2rem; color: var(--ink-soft); text-decoration: none;
  font-size: .7rem; font-weight: 600;
  border-radius: 8px; transition: color .1s, background .1s;
  min-width: 0;
}
.mobile-nav a .mn-icon { font-size: 1.3rem; line-height: 1; }
.mobile-nav a .mn-label { text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.mobile-nav a.active { color: var(--terracotta); background: var(--linen-warm); }
.mobile-nav a:hover { color: var(--ink); }
/* Bouton « Plus » — même gabarit que les onglets */
.mn-more {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: .4rem .2rem; background: transparent; border: none; cursor: pointer;
  color: var(--ink-soft); font-size: .7rem; font-weight: 600; font-family: inherit;
  border-radius: 8px; min-width: 0;
}
.mn-more .mn-icon { font-size: 1.3rem; line-height: 1; }
.mn-more.active { color: var(--terracotta); background: var(--linen-warm); }

/* Feuille « Plus » (bottom sheet) */
#mn-sheet-backdrop {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(20,18,15,.4);
  display: flex; align-items: flex-end;
  animation: mn-fade .15s ease-out;
}
.mn-sheet {
  width: 100%; background: var(--paper);
  border-radius: 18px 18px 0 0; padding: .5rem .8rem calc(1rem + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0,0,0,.25);
  animation: mn-slide .2s ease-out;
}
.mn-sheet-grab {
  width: 40px; height: 4px; border-radius: 99px; background: var(--thread);
  margin: .5rem auto .8rem;
}
.mn-sheet-item {
  display: flex; align-items: center; gap: .9rem; width: 100%;
  padding: .9rem 1rem; background: transparent; border: none; cursor: pointer;
  font: inherit; font-size: 1rem; color: var(--ink); text-align: left;
  border-radius: 12px;
}
.mn-sheet-item:hover { background: var(--linen-warm); }
.mn-sheet-item.active { color: var(--terracotta); font-weight: 700; }
.mn-sheet-ico { font-size: 1.3rem; width: 1.6rem; text-align: center; }
@keyframes mn-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mn-slide { from { transform: translateY(100%); } to { transform: translateY(0); } }

@media (max-width: 720px) {
  .mobile-nav { display: flex; }
  /* Cache la nav du header sur mobile pour ne garder que la barre du bas */
  .masthead .nav { display: none; }
  /* Padding en bas pour que le contenu ne soit pas caché par la barre */
  body { padding-bottom: 72px; }
  .footer { margin-bottom: 60px; }
}
.notif-row {
  display: flex; align-items: stretch; gap: .4rem; margin-bottom: .3rem;
}
.notif-row .notif-item { flex: 1; margin: 0; }
.notif-dismiss {
  flex: 0 0 auto; width: 2rem; border: 1px solid var(--thread);
  background: #fdfaf5; color: var(--ink-soft); border-radius: 8px;
  font-size: 1.2rem; line-height: 1; cursor: pointer;
  transition: background .1s, color .1s, border-color .1s;
}
.notif-dismiss:hover {
  background: var(--terracotta); color: #fff; border-color: var(--terracotta);
}

/* ============================== Bannière d'installation PWA ============================== */
#pwa-banner {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%);
  display: flex; align-items: center; gap: .9rem;
  max-width: min(560px, calc(100vw - 24px));
  background: var(--indigo-deep); color: #f3eee3;
  padding: .8rem 1.1rem; border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,.35); z-index: 300;
  font-size: .9rem; line-height: 1.45;
}
#pwa-banner .btn { flex: none; padding: .45rem 1rem; font-size: .85rem; }
#pwa-banner [data-pwa-close] {
  flex: none; background: transparent; border: none; color: #f3eee3;
  font-size: 1rem; cursor: pointer; opacity: .7; padding: .3rem;
}
#pwa-banner [data-pwa-close]:hover { opacity: 1; }

/* ------ Encadré « Installer l'application » (Mon espace) ------ */
.pwa-box {
  background: var(--linen-warm); border: 1px solid var(--thread);
  border-radius: 12px; padding: 1.3rem 1.5rem;
}
.pwa-box p { margin: 0 0 .9rem; }
.pwa-box p:last-child { margin-bottom: 0; }
.pwa-box .btn { margin-top: .3rem; }
.pwa-box .hint { color: var(--ink-soft); font-size: .88rem; }
.pwa-steps { margin: .6rem 0 1rem; padding-left: 1.3rem; line-height: 1.7; }
.pwa-steps li { margin-bottom: .5rem; }
.pwa-ico { font-size: 1.05em; }
.pwa-ok { color: var(--sauge); }
.pwa-ok p { color: var(--ink); margin-top: .5rem; }

/* Message quand un groupe n'a aucune sous-catégorie (publication impossible) */
.need-subcat {
  color: var(--ink-soft); font-size: .88rem; font-style: italic;
  background: var(--linen-warm); border: 1px dashed var(--thread);
  border-radius: 8px; padding: .45rem .8rem;
}
