:root {
  --ink: #17355A;
  --ink2: #266B8E;
  --teal: #0BAAB2;
  --paper: #EFF8F8;
  --line: #E2E8ED;
  --muted: #6B7785;
  --bg: #F4F7FA;
  --good: #0E7C4B;
  --bad: #B23A31;
  --warm: #C2410C;
  --gold: #8A6D00;
  --shadow: 0 1px 2px rgba(23, 53, 90, .04), 0 8px 24px rgba(23, 53, 90, .06);
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  font-family: Tahoma, 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  /* Arrière-plan : visuel bleu abstrait (courbes fluides, charte navy/bleu Red Med),
     fixé en plein écran. Léger voile navy pour homogénéiser les zones les plus vives
     sans éteindre l'image ; les cartes blanches restent parfaitement lisibles. */
  background:
    linear-gradient(135deg, rgba(8, 18, 42, .35), rgba(6, 14, 34, .5)),
    url('/assets/bg-blue.png') center center / cover fixed,
    #0a1630;
  min-height: 100vh;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1000px; margin: 0 auto; padding: 48px 18px 60px; }
[hidden] { display: none !important; }

/* Garde-fou : jamais de défilement horizontal de la page (le contenu large — tables,
   graphiques — défile dans son propre conteneur .scroll). */
html { overflow-x: hidden; }
body { overflow-x: hidden; max-width: 100%; }

/* Barre supérieure sticky : masquée en desktop, affichée en mobile (voir @media). */
.mtopbar { display: none; }

/* --- Écran d'identification --------------------------------------------- */

.gate {
  position: fixed;
  inset: 0;
  background: linear-gradient(140deg, #17355A, #0E2742 60%, #0a1d33);
  display: flex;
  /* Centrage par margin auto (et non align-items:center) : quand la boîte est plus
     haute que l'écran, le haut reste accessible/défilable au lieu d'être rogné. */
  justify-content: center;
  padding: 28px 20px;
  z-index: 100;
  overflow-y: auto;
}
.gate-box {
  background: #fff;
  border-radius: 18px;
  padding: 32px 30px;
  max-width: 640px;
  width: 100%;
  margin: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
  animation: rise .45s cubic-bezier(.2, .8, .2, 1);
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.gate-eyebrow {
  font-family: Tahoma, sans-serif;
  font-size: 18px; letter-spacing: 0; text-transform: none;
  color: var(--teal); font-weight: 400; margin-bottom: 8px;
}
.gate-lock { font-size: 40px; line-height: 1; margin: 6px 0 10px; }
.gate-box h1 { margin: 0 0 6px; font-family: Tahoma, sans-serif; font-size: 24px; letter-spacing: -.3px; }
.gate-box p.lead { margin: 0 0 20px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.gate-section {
  margin: 4px 0 12px; font-size: 13px; font-weight: 700; color: var(--ink);
  text-transform: uppercase; letter-spacing: .8px;
  padding-top: 16px; border-top: 1px solid var(--line);
}

.dir-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.dir-card {
  display: flex; align-items: center; gap: 12px;
  border: 1.5px solid var(--line); background: #fff;
  border-radius: 12px; padding: 13px 14px;
  cursor: pointer; text-align: left; width: 100%;
  font-family: inherit; font-size: 14px; color: var(--ink);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.dir-card:hover { border-color: var(--teal); transform: translateY(-2px); box-shadow: var(--shadow); }
.dir-card:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--teal), var(--ink2));
  color: #fff; font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.dir-name { font-weight: 700; line-height: 1.3; }
.dir-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* --- Structure ----------------------------------------------------------- */

.hero {
  /* Même visuel bleu que le fond de page, avec un voile plus soutenu (texte blanc
     dessus). Liseré + ombre pour que la bande se détache comme un panneau. */
  background:
    linear-gradient(135deg, rgba(11, 26, 58, .60), rgba(9, 20, 46, .74)),
    url('/assets/bg-blue.png') center center / cover no-repeat;
  color: #fff; border-radius: 16px; padding: 34px 26px 26px; margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .28);
}
.hero-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.hero-logo { height: 40px; width: auto; display: block; }
.hero-confid {
  font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: #9DB2CE; border: 1px solid rgba(255, 255, 255, .22); border-radius: 20px;
  padding: 5px 12px; white-space: nowrap; flex: none;
}
.hero h1 { margin: 0 0 6px; font-family: Tahoma, sans-serif; font-size: 24px; letter-spacing: -.3px; }
.hero p { margin: 0; color: #9DB2CE; font-size: 14px; line-height: 1.6; }
.hero-eyebrow {
  font-family: Tahoma, sans-serif;
  font-size: 18px; letter-spacing: 0; text-transform: none;
  color: var(--teal); font-weight: 400; margin-bottom: 8px;
}
.hero-bar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin-top: 18px;
  padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .14);
}
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.who .avatar { width: 32px; height: 32px; font-size: 12px; }
.link-btn {
  background: none; border: none; color: #9DB2CE; font-family: inherit;
  font-size: 12px; cursor: pointer; text-decoration: underline; padding: 4px;
}
.link-btn:hover { color: #fff; }

.card {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px;
}
.card h2 { font-size: 18px; margin: 0 0 14px; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.6; margin: -6px 0 14px; }

.tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 10px; padding: 10px 16px; cursor: pointer;
  font-family: inherit; font-size: 13.5px; font-weight: 700;
  transition: all .15s;
}
.tab:hover { border-color: var(--teal); color: var(--ink); }
.tab[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab .badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  border-radius: 20px; background: var(--teal); color: #fff; font-size: 11px;
}

/* --- KPIs & tableaux ----------------------------------------------------- */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { border: 1px solid var(--line); border-top: 3px solid var(--teal); border-radius: 12px; padding: 18px 20px; }
.kpi .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.kpi .v { font-size: 28px; font-weight: 800; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--ink); color: #fff; text-align: left; padding: 8px 10px; position: sticky; top: 0; }
td { padding: 7px 10px; border-bottom: 1px solid var(--line); }
tr:nth-child(even) td { background: var(--paper); }
/* Présent : Oui = turquoise (cyan charte), Non = bleu dark (navy charte). */
.ok { color: var(--teal); font-weight: 700; }
.no { color: var(--ink); font-weight: 700; }
.scroll { overflow: auto; max-height: 520px; border: 1px solid var(--line); border-radius: 10px; }

.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.bar-label { width: 58px; font-size: 12px; font-weight: 700; }
.bar-track { flex: 1; background: var(--paper); border-radius: 6px; overflow: hidden; height: 16px; }
.bar-fill { height: 100%; background: var(--teal); border-radius: 6px; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.bar-val { width: 72px; font-size: 11px; color: var(--muted); text-align: right; }

.legend { display: flex; align-items: center; gap: 6px; font-size: 11px; margin-bottom: 3px; min-width: 150px; }
.dot { width: 10px; height: 10px; border-radius: 2px; flex: none; }

/* --- Graphes du bilan ---------------------------------------------------- */

.chart-title { font-size: 12.5px; font-weight: 800; color: var(--ink); margin-bottom: 14px; letter-spacing: .2px; }
.chart-legend { display: flex; gap: 20px; margin-top: 16px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.chart-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.sw-present { background: linear-gradient(180deg, var(--teal), var(--ink2)); }
.sw-noshow { background: #B9C4CF; }
.sw-inv { background: var(--ink2); }
.sw-pres { background: var(--teal); }

/* Colonnes empilées : présents / no-show par soirée */
.sb-chart { display: flex; align-items: flex-end; gap: 12px; padding-bottom: 10px; border-bottom: 1.5px solid var(--line); }
.sb-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.sb-top { min-height: 15px; font-size: 11px; font-weight: 800; letter-spacing: -.2px; color: var(--ink2); line-height: 1; }
.sb-top .ns { color: var(--muted); font-weight: 600; }
.sb-stack { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch;
  width: 100%; max-width: 66px; gap: 2px; }
.sb-noshow, .sb-present { transform-origin: bottom; animation: sbGrow .6s cubic-bezier(.2, .8, .2, 1);
  display: flex; align-items: center; justify-content: center; overflow: hidden; }
.sb-noshow { background: #B9C4CF; border-radius: 5px 5px 0 0; }
.sb-present { background: linear-gradient(180deg, var(--teal), var(--ink2)); box-shadow: 0 2px 6px rgba(23, 53, 90, .18); }
.sb-in-pct { font-size: 10px; line-height: 1; font-weight: 800; color: #fff; white-space: nowrap; letter-spacing: -.3px; text-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.sb-in-ns { font-size: 10px; line-height: 1; font-weight: 700; color: #46525E; white-space: nowrap; }
.sb-count { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.3; }
.sb-count strong { color: var(--ink); font-size: 12px; }
.sb-date { font-size: 12px; font-weight: 700; color: var(--ink); }
@keyframes sbGrow { from { transform: scaleY(0); } }

/* Colonnes empilées : invités par soirée, ventilés par filiale */
.fsb-chart { display: flex; align-items: flex-end; gap: 12px; padding-bottom: 10px; border-bottom: 1.5px solid var(--line); }
.fsb-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.fsb-stack { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch;
  width: 100%; max-width: 66px; border-radius: 5px; overflow: hidden; box-shadow: 0 2px 6px rgba(23, 53, 90, .14); }
.fsb-seg { transform-origin: bottom; animation: sbGrow .6s cubic-bezier(.2, .8, .2, 1);
  display: flex; align-items: center; justify-content: center; overflow: hidden; }
.fsb-seg span { font-size: 10px; line-height: 1; font-weight: 800; letter-spacing: -.3px; }
.fsb-tot { font-size: 11px; color: var(--muted); line-height: 1.3; }
.fsb-tot strong { color: var(--ink); font-size: 12px; }
.fsb-date { font-size: 12px; font-weight: 700; color: var(--ink); }

/* Camembert des institutions : titre + légende multi-colonnes */
.pie-title { font-size: 12.5px; font-weight: 800; color: var(--ink); margin-bottom: 14px; }
.pie-title span { font-weight: 600; color: var(--muted); }
.pie-wrap { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.pie-legend { flex: 1; min-width: 260px; display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 5px 16px; }
.pie-lg { display: flex; align-items: center; gap: 7px; font-size: 11.5px; line-height: 1.25; }
.pie-lg .dot { width: 10px; height: 10px; border-radius: 2px; flex: none; }
@media (max-width: 620px) { .pie-wrap { justify-content: center; } }

/* Bilan par nature du contact (onglet invités) */
.ts-row{display:grid; grid-template-columns:160px 1fr auto; align-items:center; gap:12px; margin-bottom:9px;}
.ts-row:last-of-type{margin-bottom:2px;}
.ts-name{font-size:13px; font-weight:700; color:var(--ink); display:flex; align-items:center; gap:8px;}
.ts-dot{width:11px; height:11px; border-radius:3px; flex:none;}
.ts-track{background:var(--paper); border-radius:6px; overflow:hidden; height:15px;}
.ts-fill{height:100%; border-radius:6px; transition:width .5s cubic-bezier(.2,.8,.2,1);}
.ts-val{font-size:12.5px; color:var(--muted); white-space:nowrap;} .ts-val b{color:var(--ink);}
@media (max-width:520px){ .ts-row{grid-template-columns:120px 1fr auto; gap:8px;} }

/* Quote-part par filiale : tableau + camembert (sans montant) */
.fp-wrap { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.fp-table-box { flex: 1; min-width: 300px; }
.fp-pie { flex: none; }
.fp-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.fp-table th {
  background: none; color: var(--muted); font-weight: 700; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .4px; text-align: right;
  padding: 6px 10px; border-bottom: 1.5px solid var(--line); position: static;
}
.fp-table th:first-child { text-align: left; }
.fp-table td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line); }
.fp-table td:first-child { text-align: left; font-weight: 700; color: var(--ink); }
.fp-table tbody tr:nth-child(even) td { background: none; }
.fp-sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }
.fp-total td { border-top: 1.5px solid var(--line); border-bottom: none; font-weight: 800; color: var(--ink); padding-top: 12px; }
@media (max-width: 620px) { .fp-pie { margin: 0 auto; } }

/* Léger relief au survol des tuiles KPI */
.kpi { transition: transform .15s, box-shadow .15s; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* Tableau épuré (Présence par soirée) */
.tbl-clean { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl-clean thead th {
  background: none; color: var(--muted); font-weight: 700; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .6px; text-align: right;
  padding: 0 14px 11px; border-bottom: 1.5px solid var(--line); position: static;
}
.tbl-clean thead th:first-child { text-align: left; }
.tbl-clean tbody td {
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  text-align: right; background: none; font-variant-numeric: tabular-nums;
}
.tbl-clean tbody td:first-child { text-align: left; font-weight: 700; color: var(--ink); }
.soiree-art { display: block; font-weight: 600; font-size: 11.5px; color: var(--teal); margin-top: 2px; }
.tbl-clean tbody tr { transition: background .12s; }
.tbl-clean tbody tr:hover td { background: var(--paper); }
.tbl-clean tr.tbl-total td {
  border-top: 2px solid var(--ink); border-bottom: none;
  font-weight: 800; color: var(--ink); padding-top: 14px;
}
.tbl-clean tr.tbl-total:hover td { background: none; }
.taux-pill {
  display: inline-block; min-width: 54px; text-align: center;
  padding: 3px 10px; border-radius: 20px; font-weight: 700; font-size: 12.5px;
}
/* Niveaux de taux dans les tons de la charte (pas de vert/rouge hors charte) :
   fort = cyan principal, moyen = bleu signature, faible = bleu institutionnel. */
.taux-pill.ok  { background: rgba(11, 170, 178, .15); color: #0B7C82; }
.taux-pill.mid { background: rgba(38, 107, 142, .12); color: var(--ink2); }
.taux-pill.no  { background: rgba(23, 53, 90, .10);   color: var(--ink); }

/* Barres marque employeur — dégradé de bleu, plus aérées */
.cb-fill { background: linear-gradient(90deg, var(--ink2), var(--ink)); }
#collabBars .bar-row { margin-bottom: 12px; gap: 12px; }
#collabBars .bar-track { height: 14px; }
#collabBars .bar-label { width: 66px; }

/* --- Photothèque (carrousel) --------------------------------------------- */
.carousel { position: relative; border-radius: 14px; overflow: hidden; background: #0b1524; box-shadow: var(--shadow); }
.carousel-track { display: flex; transition: transform .6s cubic-bezier(.4, 0, .2, 1); }
.carousel-slide { min-width: 100%; aspect-ratio: 16 / 9; }
.carousel-slide img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.car-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(11, 21, 36, .45); border: none; color: #fff; cursor: pointer;
  width: 42px; height: 42px; border-radius: 50%; font-size: 24px; line-height: 1;
  display: flex; align-items: center; justify-content: center; transition: background .15s;
  backdrop-filter: blur(2px);
}
.car-btn:hover { background: rgba(11, 21, 36, .75); }
.car-prev { left: 12px; }
.car-next { right: 12px; }
.car-dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.car-dot { width: 8px; height: 8px; padding: 0; border: none; border-radius: 50%; background: rgba(255, 255, 255, .45); cursor: pointer; transition: all .2s; }
.car-dot:hover { background: rgba(255, 255, 255, .7); }
.car-dot.active { background: #fff; width: 22px; border-radius: 4px; }
@media (max-width: 560px) { .car-btn { width: 36px; height: 36px; font-size: 20px; } }

.lightbox {
  position: fixed; inset: 0; z-index: 200; padding: 24px;
  background: rgba(10, 20, 35, .93); display: flex; align-items: center; justify-content: center;
  animation: lbFade .2s ease;
}
@keyframes lbFade { from { opacity: 0; } }
.lb-figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lb-img { max-width: 92vw; max-height: 82vh; border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.lb-count { color: rgba(255, 255, 255, .78); font-size: 12.5px; letter-spacing: .5px; }
.lb-btn {
  position: absolute; background: rgba(255, 255, 255, .12); border: none; color: #fff; cursor: pointer;
  border-radius: 50%; width: 46px; height: 46px; font-size: 26px; line-height: 1;
  display: flex; align-items: center; justify-content: center; transition: background .15s;
}
.lb-btn:hover { background: rgba(255, 255, 255, .26); }
.lb-close { top: 20px; right: 20px; font-size: 30px; }
.lb-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 20px; top: 50%; transform: translateY(-50%); }
@media (max-width: 560px) {
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
}

/* --- Base des invités ---------------------------------------------------- */

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
input, select {
  font-family: inherit; font-size: 14px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff;
}
input:focus, select:focus { outline: 2px solid var(--teal); outline-offset: -1px; border-color: var(--teal); }
.filters input { flex: 1; min-width: 200px; }

.conv-select { font-size: 12px; padding: 5px 6px; border-radius: 7px; cursor: pointer; }
.chip {
  display: inline-block; padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
}

/* --- Sondage : une question à la fois ------------------------------------ */

.survey-stage { min-height: 420px; display: flex; flex-direction: column; }
.progress-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.progress-track { flex: 1; height: 6px; background: var(--paper); border-radius: 20px; overflow: hidden; }
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--teal), var(--ink2));
  border-radius: 20px; transition: width .4s cubic-bezier(.2, .8, .2, 1);
}
.progress-num { font-size: 12px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.section-tag {
  display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .5px;
  text-transform: uppercase; color: var(--ink2); margin-bottom: 10px;
}

.q-body { flex: 1; padding: 8px 0 20px; animation: qin .3s cubic-bezier(.2, .8, .2, 1); }
@keyframes qin { from { opacity: 0; transform: translateX(12px); } }
.q-body.back { animation: qback .3s cubic-bezier(.2, .8, .2, 1); }
@keyframes qback { from { opacity: 0; transform: translateX(-12px); } }
.q-label { font-size: 21px; font-weight: 700; line-height: 1.35; margin: 0 0 6px; letter-spacing: -.2px; }
.q-help { font-size: 13.5px; color: var(--muted); margin: 0 0 22px; line-height: 1.5; }

/* Étoiles */
.stars { display: flex; gap: 6px; }
.star {
  background: none; border: none; cursor: pointer; padding: 4px;
  font-size: 40px; line-height: 1; color: var(--line);
  transition: transform .12s, color .12s;
}
.star:hover { transform: scale(1.15); }
.star.on { color: #F0B429; }
.star:focus-visible { outline: 2px solid var(--teal); border-radius: 6px; }
.stars-caption { font-size: 13px; color: var(--ink2); font-weight: 700; margin-top: 10px; height: 18px; }

/* Boutons-cartes */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.choice {
  border: 2px solid var(--line); background: #fff; border-radius: 12px;
  padding: 16px 14px; cursor: pointer; text-align: left;
  font-family: inherit; color: var(--ink);
  transition: all .15s;
}
.choice:hover { border-color: var(--teal); transform: translateY(-2px); }
.choice:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.choice.on { border-color: var(--teal); background: var(--paper); box-shadow: inset 0 0 0 1px var(--teal); }
.choice.on.good { border-color: var(--good); background: #E8F6EE; box-shadow: inset 0 0 0 1px var(--good); }
.choice.on.bad { border-color: var(--bad); background: #FBECEA; box-shadow: inset 0 0 0 1px var(--bad); }
.choice.on.mid { border-color: var(--gold); background: #FBF6E5; box-shadow: inset 0 0 0 1px var(--gold); }
.choice-label { font-weight: 800; font-size: 15px; }
.choice-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* Compteur */
.stepper { display: flex; align-items: center; gap: 12px; }
.step-btn {
  width: 48px; height: 48px; border-radius: 12px; border: 2px solid var(--line);
  background: #fff; font-size: 24px; font-weight: 700; color: var(--ink);
  cursor: pointer; line-height: 1; transition: all .15s;
}
.step-btn:hover { border-color: var(--teal); background: var(--paper); }
.step-btn:disabled { opacity: .35; cursor: not-allowed; }
.step-val {
  width: 110px; text-align: center; font-size: 30px; font-weight: 800;
  border: 2px solid var(--line); border-radius: 12px; padding: 7px;
  -moz-appearance: textfield;
}
.step-val::-webkit-outer-spin-button, .step-val::-webkit-inner-spin-button { -webkit-appearance: none; }
.step-unit { font-size: 13px; color: var(--muted); }

/* Montant */
.money-input { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.money-val {
  font-size: 26px; font-weight: 800; width: 220px;
  border: 2px solid var(--line); border-radius: 12px; padding: 9px 12px;
}
.presets { display: flex; gap: 8px; flex-wrap: wrap; }
.preset {
  border: 1.5px solid var(--line); background: #fff; border-radius: 20px;
  padding: 7px 14px; font-size: 12.5px; font-weight: 700; cursor: pointer;
  font-family: inherit; color: var(--ink2); transition: all .15s;
}
.preset:hover { border-color: var(--teal); background: var(--paper); }

/* NPS 0-10 */
.nps { display: flex; gap: 5px; flex-wrap: wrap; }
.nps-btn {
  width: 52px; height: 52px; border-radius: 10px; border: 2px solid var(--line);
  background: #fff; font-family: inherit; font-size: 15px; font-weight: 800;
  color: var(--ink); cursor: pointer; transition: all .12s;
}
.nps-btn:hover { transform: translateY(-3px); border-color: var(--teal); }
.nps-btn.on { color: #fff; border-color: transparent; transform: translateY(-3px); }
.nps-scale {
  display: flex; justify-content: space-between; font-size: 11.5px;
  color: var(--muted); margin-top: 8px; max-width: 640px;
}

/* Texte libre */
.q-text {
  width: 100%; min-height: 130px; font-family: inherit; font-size: 15px;
  padding: 14px; border: 2px solid var(--line); border-radius: 12px;
  resize: vertical; line-height: 1.6; color: var(--ink);
}
.q-text:focus { outline: none; border-color: var(--teal); }
.q-text.short { min-height: 64px; }
.char-count { font-size: 11.5px; color: var(--muted); text-align: right; margin-top: 4px; }

/* Encadré groupé (correction du bilan : nb conviés + nb présents + précisions) */
.grp-box { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: var(--paper); display: flex; flex-direction: column; gap: 18px; }
.grp-field { display: flex; flex-direction: column; gap: 8px; }
.grp-label { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.grp-field .q-text { min-height: 90px; background: #fff; }

/* Échelle 1-5 avec libellés d'extrémités */
.scale { display: flex; gap: 8px; flex-wrap: wrap; }
.scale-btn {
  width: 56px; height: 56px; border-radius: 12px; border: 2px solid var(--line);
  background: #fff; font-family: inherit; font-size: 18px; font-weight: 800;
  color: var(--ink); cursor: pointer; transition: all .12s;
}
.scale-btn:hover { transform: translateY(-3px); border-color: var(--teal); }
.scale-btn.on { background: var(--teal); color: #fff; border-color: var(--teal); transform: translateY(-3px); }
.scale-ends {
  display: flex; justify-content: space-between; font-size: 11.5px;
  color: var(--muted); margin-top: 8px; max-width: 360px;
}

/* Intro d'axe affichée sur la première question de chaque section */
.section-intro { margin-bottom: 20px; }

/* Carte descriptive du bilan de participation (dans le sondage) */
.part-card {
  background: var(--paper); border: 1px solid var(--line);
  border-left: 4px solid var(--teal); border-radius: 12px;
  padding: 16px 18px; margin: 0 0 22px;
}
.part-title { font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; color: var(--ink2); margin-bottom: 12px; }
.part-nums { display: flex; flex-wrap: wrap; gap: 22px; }
.part-nums > div { display: flex; flex-direction: column; }
.pn-v { font-size: 26px; font-weight: 800; line-height: 1.1; }
.pn-l { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Sélecteur d'invités */
.guest-pick { display: flex; flex-wrap: wrap; gap: 8px; max-height: 300px; overflow-y: auto; padding: 2px; }
.guest-chip {
  border: 1.5px solid var(--line); background: #fff; border-radius: 20px;
  padding: 8px 14px; font-family: inherit; font-size: 13px; cursor: pointer;
  color: var(--ink); transition: all .15s; text-align: left;
}
.guest-chip:hover { border-color: var(--teal); }
.guest-chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.guest-chip .g-inst { font-size: 11px; opacity: .7; display: block; }

/* Navigation */
.q-nav {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding-top: 18px; border-top: 1px solid var(--line);
}
.btn {
  background: var(--teal); color: #fff; border: none; border-radius: 10px;
  padding: 12px 20px; font-family: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: filter .15s, transform .1s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--teal); }
.btn.dark { background: var(--ink); }
.saved-flag { font-size: 12px; color: var(--good); font-weight: 700; opacity: 0; transition: opacity .3s; }
.saved-flag.show { opacity: 1; }

/* Écran de fin */
.done { text-align: center; padding: 40px 20px; animation: rise .5s; }
.done-check {
  width: 76px; height: 76px; border-radius: 50%; background: #E8F6EE;
  color: var(--good); font-size: 40px; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
}
.done h3 { font-size: 22px; margin: 0 0 8px; }
.done p { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0 auto 22px; max-width: 460px; }

/* Récapitulatif */
.recap { display: grid; gap: 6px; margin: 20px 0; text-align: left; }
.recap-row {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 13px;
}
.recap-q { color: var(--muted); }
.recap-a { font-weight: 700; text-align: right; }

/* Footer sur le canvas navy : teinte claire lisible. Sur l'écran d'identification
   (carte blanche), il reprend la teinte sourde d'origine. */
.footer { text-align: center; font-size: 12px; color: #9DB2CE; margin-top: 8px; line-height: 1.6; }
.gate-box .footer { color: var(--muted); }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 13px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1); z-index: 200;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* --- Notification & prochaine vague ------------------------------------- */

.notice {
  display: flex; align-items: flex-start; gap: 12px;
  background: linear-gradient(135deg, #E8F6F6, #EAF1F8);
  border: 1px solid #CDE6E6; border-left: 4px solid var(--teal);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px;
}
.notice-body { font-size: 13.5px; line-height: 1.6; color: var(--ink); }
.notice-close {
  margin-left: auto; background: none; border: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--muted); flex: none; padding: 0 2px;
}
.notice-close:hover { color: var(--ink); }

.next-wave {
  text-align: left;
  background: var(--paper); border: 1px solid var(--line);
  border-left: 4px solid var(--teal); border-radius: 12px;
  padding: 14px 16px; margin: 22px auto 0; max-width: 560px;
  font-size: 13.5px; line-height: 1.6; color: var(--ink);
}

@media (max-width: 600px) {
  .wrap { padding: 14px 12px 48px; }
  .hero h1 { font-size: 21px; }
  .q-label { font-size: 18px; }
  .nps-btn { width: 40px; height: 40px; font-size: 14px; }
  .scale-btn { width: 48px; height: 48px; font-size: 16px; }
  .scale-ends { max-width: none; }
  .star { font-size: 34px; }
  .gate-box { padding: 24px 20px; }
  .part-nums { gap: 16px; }
  .pn-v { font-size: 22px; }
  .table-wrap, .scroll { font-size: 12px; }
}

/* ======================================================================
   Version mobile dédiée (≤ 640 px) — barre supérieure sticky (logo + identité),
   barre d'onglets fixe en bas, cartes invités, formulaire au pouce. Scopée à #app
   pour ne pas toucher l'admin (#main). Le sondage garde son stepper une-question.
   ====================================================================== */
@media (max-width: 640px) {
  /* Anti-zoom iOS : tout champ saisissable ≥ 16px. */
  input, select, textarea, .q-text { font-size: 16px !important; }

  /* Réserve la hauteur de la barre FIXE du haut + la barre d'onglets du bas (zones sûres iPhone). */
  #app.wrap { padding: calc(58px + env(safe-area-inset-top)) 12px calc(88px + env(safe-area-inset-bottom)); }

  /* Aucune carte/section ne doit déborder horizontalement. */
  #app .card, #app section, #app .hero { max-width: 100%; overflow-x: hidden; }
  #app .card { padding: 16px 14px; }

  /* --- Barre supérieure FIXE (logo + identité) — reste visible au défilement.
     (position: fixed, car overflow-x:hidden global casse position: sticky.) --- */
  #app .mtopbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: fixed; top: 0; left: 0; right: 0; z-index: 55;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    background: rgba(10, 22, 48, .95); backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, .1);
  }
  #app .mtopbar-logo { height: 26px; width: auto; display: block; }
  #app .mtopbar-name {
    color: #fff; font-weight: 700; font-size: 13px;
    max-width: 55vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right;
  }

  /* --- Hero compact : plus court, laisse voir le contenu tout de suite --- */
  #app .hero { margin-top: 4px; padding: 16px 16px 18px; }
  #app .hero-head { display: none; } /* logo + « confidentiel » : déjà dans la barre du haut */
  #app .hero h1 { font-size: 20px; }
  #app .hero p { font-size: 12.5px; }
  #app .hero-bar { margin-top: 12px; }

  /* Graphiques larges : défilent dans leur conteneur plutôt que d'élargir la page. */
  #app .sb-chart, #app .fsb-chart, #app .scroll, #app .table-wrap { max-width: 100%; overflow-x: auto; }

  /* --- Barre d'onglets fixe en bas (Bilan / Invités / Sondage) --- */
  #app .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    margin: 0; gap: 0; flex-wrap: nowrap;
    background: #fff; border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 20px rgba(14, 39, 66, .08);
  }
  #app .tabs .tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; min-height: 54px; padding: 6px 2px;
    border: none !important; background: none !important; border-radius: 12px;
    color: var(--muted); font-size: 0; transition: background .15s, color .15s;
  }
  #app .tabs .tab[aria-selected="true"] { background: var(--paper) !important; color: var(--ink) !important; }
  #app .tabs .tab::before { font-size: 21px; line-height: 1; }
  #app .tabs .tab::after { font-size: 11px; font-weight: 800; line-height: 1; letter-spacing: .2px; }
  #app .tab[data-view="bilan"]::before   { content: "📊"; }
  #app .tab[data-view="bilan"]::after    { content: "Bilan"; }
  #app .tab[data-view="invites"]::before { content: "👥"; }
  #app .tab[data-view="invites"]::after  { content: "Invités"; }
  #app .tab[data-view="sondage"]::before { content: "📝"; }
  #app .tab[data-view="sondage"]::after  { content: "Sondage"; }
  #app .tabs .tab .badge { display: none; }

  /* --- Barre de progression du sondage collante en haut --- */
  #app #view-sondage .progress-head {
    position: sticky; top: 0; z-index: 5;
    background: #fff; padding: 10px 0; margin: -4px 0 4px;
  }
  #app .q-nav { gap: 10px; }
  #app .q-nav .btn { min-height: 48px; flex: 1; }

  /* --- Table des invités → cartes empilées --- */
  .inv-mobile thead { display: none; }
  .inv-mobile, .inv-mobile tbody, .inv-mobile tr, .inv-mobile td { display: block; width: 100%; }
  .inv-mobile { border: 0; }
  .inv-mobile tr {
    border: 1px solid var(--line); border-radius: 14px;
    padding: 12px 14px; margin-bottom: 12px; background: #fff;
    box-shadow: 0 1px 3px rgba(14, 39, 66, .05);
  }
  .inv-mobile td {
    border: none !important; padding: 6px 0;
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    min-height: 34px;
  }
  .inv-mobile td::before {
    content: attr(data-label); font-weight: 700; color: var(--muted);
    font-size: 12px; flex: none;
  }
  .inv-mobile td.inv-name { font-size: 17px; font-weight: 800; padding-top: 2px; }
  .inv-mobile td.inv-name::before { display: none; }
  .inv-mobile td select { flex: 1; max-width: 60%; min-height: 42px; }

  /* Cibles tactiles confortables. */
  #app .btn, #app .link-btn { min-height: 44px; }
  #app .choice { min-height: 56px; }
}

@media print {
  .tabs, .q-nav, .gate, .hero-bar, .filters { display: none !important; }
  .card { break-inside: avoid; border-color: #ccc; }
  body { background: #fff; }
}
