/* EPN Calendar — charte « Osons le numérique » (Plan d'inclusion numérique, Wallonie)
   Couleurs officielles ; logo EPN en bleu hors environnement Osons le numérique.
   Typo : Baton Turbo (licence) → alternative Inter → repli système Helvetica. */

/* Inter auto-hébergée (licence OFL, aucun appel à Google Fonts) */
@font-face {
  font-family: "Inter";
  src: url("fonts/Inter-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/Inter-Italic-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --blue: #0067a1;
  --blue-light: #c7ebec;
  --red: #d03740;
  --pink: #fce6e6;
  --orange: #fe6c00;
  --yellow: #fff1b6;
  --ink: #4b4b4b;
  --white: #ffffff;

  --bg: #ffffff;
  --surface: #ffffff;
  --text: var(--ink);
  --muted: #6b6b6b;
  --line: #e3e3e3;
  --primary: var(--blue);
  --primary-ink: #ffffff;
  --danger: var(--red);

  --radius: 14px;
  --font: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14181c;
    --surface: #1d2328;
    --text: #eceff1;
    --muted: #a5adb4;
    --line: #2e363d;
    --primary: #4fa3d9;
    --primary-ink: #0b1a24;
    --danger: #ef6f76;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-text-size-adjust: 100%;
}

h1, h2 { color: var(--primary); line-height: 1.2; letter-spacing: -0.02em; }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 0 0 1rem; }
a { color: var(--primary); }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem max(16px, env(safe-area-inset-right)) 3rem max(16px, env(safe-area-inset-left));
}
.container.narrow { max-width: 440px; padding-top: 3rem; }

/* Barre admin */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1.25rem;
  padding: .75rem max(16px, env(safe-area-inset-right)) .75rem max(16px, env(safe-area-inset-left));
  padding-top: max(.75rem, env(safe-area-inset-top));
  /* Fond clair : la charte impose le logo EPN en bleu hors environnement Osons */
  background: var(--surface);
  color: var(--primary);
  border-bottom: 3px solid var(--primary);
}
.topbar a { color: inherit; text-decoration: none; }
.topbar .brand { display: flex; }
.topbar .brand img { display: block; height: 44px; width: auto; }
.logo { display: block; height: auto; max-width: 100%; margin: 0 0 1.5rem; }
.topbar nav { display: flex; gap: 1rem; flex: 1; overflow-x: auto; }
.topbar nav a { opacity: .85; padding: .25rem 0; white-space: nowrap; }
.topbar nav a[aria-current="page"] { opacity: 1; border-bottom: 2px solid currentColor; }
.logout { margin-left: auto; }
.topbar-menu { display: flex; flex: 1; align-items: center; gap: .5rem 1.25rem; min-width: 0; }

/* Menu hamburger : uniquement sur petit écran */
.menu-toggle { display: none; }
@media (max-width: 700px) {
  .menu-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; margin-left: auto; padding: 10px;
    border: 0; border-radius: 10px; background: transparent; cursor: pointer;
  }
  .menu-toggle span { display: block; height: 2px; border-radius: 2px; background: var(--primary); transition: transform .2s, opacity .2s; }
  .topbar.is-open .menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .topbar.is-open .menu-toggle span:nth-child(2) { opacity: 0; }
  .topbar.is-open .menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .topbar-menu { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 0; border-top: 1px solid var(--line); }
  .topbar.is-open .topbar-menu { display: flex; }
  .topbar-menu nav { flex-direction: column; gap: 0; overflow: visible; }
  .topbar-menu nav a { padding: .85rem .25rem; border-bottom: 1px solid var(--line); font-size: 1.05rem; opacity: 1; }
  .topbar-menu nav a[aria-current="page"] { border-bottom: 1px solid var(--line); font-weight: 700; box-shadow: inset 4px 0 0 var(--primary); padding-left: .75rem; }
  .topbar-menu .logout { margin: 0; padding: .85rem .25rem; }
  .topbar-menu .logout .btn-link { font-size: 1.05rem; }
}

/* Sous-menu des réglages */
.subnav {
  display: flex;
  gap: .4rem;
  overflow-x: auto;
  padding: .6rem max(16px, env(safe-area-inset-right)) .6rem max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--blue-light) 45%, var(--surface));
  border-bottom: 1px solid var(--line);
}
.subnav a {
  flex: none;
  padding: .35rem .9rem;
  border-radius: 999px;
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.subnav a[aria-current="page"] { background: var(--primary); color: var(--primary-ink); }

/* Séances côté public */
.event-type {
  display: inline-block;
  margin: 0 0 .5rem;
  padding: .15rem .7rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 18%, var(--surface));
  color: var(--text);
  font-weight: 700;
  font-size: .9rem;
}
.event-description p { margin: 0 0 .9rem; }
.event-list { display: grid; gap: .6rem; }
.event-row {
  display: grid;
  gap: .1rem;
  padding: .75rem 1rem;
  border-radius: 12px;
  border-left: 5px solid var(--c);
  background: color-mix(in srgb, var(--c) 8%, var(--surface));
  color: var(--text);
  text-decoration: none;
}
.event-row:hover { background: color-mix(in srgb, var(--c) 16%, var(--surface)); }
.event-row-type { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* Blocs */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.25rem 0;
}
.card.notice { background: var(--blue-light); border-color: transparent; color: var(--ink); }

.muted { color: var(--muted); }
.small { font-size: .9rem; }

/* Formulaires (16px minimum : évite le zoom automatique sur iOS) */
.stack { display: grid; gap: 1rem; }
.row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
label { display: grid; gap: .35rem; font-weight: 600; }
input, textarea, select {
  font: inherit;
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .65rem .8rem;
  width: 100%;
}
input[type="color"] { padding: .2rem; height: 2.9rem; }
input:focus-visible, textarea:focus-visible, select:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}
.actions { display: flex; flex-wrap: wrap; gap: .75rem; }

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: .55rem 1.1rem;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn-ghost { background: transparent; color: var(--primary); box-shadow: inset 0 0 0 1px var(--line); }
.btn-danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px var(--line); }
.btn-link { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }

/* Messages */
.flash { border-radius: 10px; padding: .75rem 1rem; margin: 0 0 1rem; }
.flash-success { background: var(--blue-light); color: #0b3b57; }
.flash-error { background: var(--pink); color: #8a1f26; }
ul.flash { padding-left: 2rem; }

/* Listes d'éléments (types de RDV…) */
.list { display: grid; gap: .75rem; }
.item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .9rem 1rem;
}
.item.is-inactive { opacity: .6; }
.item-body { display: grid; flex: 1 1 220px; }
.item-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.item-actions form { margin: 0; }
.swatch { width: 14px; height: 14px; border-radius: 50%; flex: none; }

/* Séances : statut, lien de partage, tableau des inscrits */
.status { font-weight: 700; }
.status-published { color: #1a7f37; }
.status-draft { color: var(--muted); }
.status-cancelled { color: var(--danger); }
.share { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.share input { flex: 1 1 260px; font-size: .9rem; padding: .45rem .7rem; background: color-mix(in srgb, var(--blue-light) 35%, var(--bg)); }
.share .btn { min-height: 38px; padding: .3rem .9rem; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); text-align: left; }
.table th { color: var(--primary); font-size: .9rem; }
.table tr.is-cancelled td { color: var(--muted); text-decoration: line-through; }
.table tr.is-cancelled .badge { text-decoration: none; }

/* Liste de présence imprimable (A4) */
.print-page { background: #fff; color: #000; }
.print-sheet { max-width: 800px; margin: 0 auto; padding: 1.5rem 16px; }
.print-head { display: flex; gap: 1.5rem; align-items: flex-start; margin-bottom: 1rem; }
.print-head img { flex: none; width: 3.5cm; height: auto; }
.print-head > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.print-head h1 { margin: 0 0 .25rem; font-size: 1.4rem; }
.print-head p { margin: 0 0 .25rem; }
/* Largeurs figées : le tableau ne peut jamais s'élargir au-delà de la page */
.attendance { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 11pt; }
.attendance th, .attendance td { border: 1px solid #555; padding: 0 .4rem; height: 1cm; text-align: left; overflow-wrap: anywhere; }
.attendance th { height: auto; padding: .35rem .4rem; background: #eef6f7; }
.attendance .col-check { width: 12%; text-align: center; }
.attendance .col-name { width: 27%; }
.attendance .col-first { width: 25%; }
.attendance .col-email { width: 36%; }
.attendance .col-known { background: repeating-linear-gradient(135deg, #f1f1f1 0 4px, #fff 4px 8px); }
.attendance .box { display: inline-block; width: .45cm; height: .45cm; border: 1.5px solid #333; }
.print-foot { margin-top: .75rem; font-size: 8.5pt; color: #555; }
@media print {
  @page { size: A4 portrait; margin: 15mm; }
  html, body { width: auto; margin: 0; padding: 0; }
  .no-print { display: none !important; }
  /* 1 px de retrait : la bordure extérieure du tableau reste dans la zone imprimable */
  .print-sheet { width: 100%; max-width: none; margin: 0; padding: 0 1px; }
  .attendance tr { break-inside: avoid; }
  .attendance thead { display: table-header-group; }
}

/* Annulation d'un RDV depuis le tableau de bord */
.cancel-box > summary { list-style: none; }
.cancel-box > summary::-webkit-details-marker { display: none; }
.cancel-box[open] { flex: 1 1 100%; }
.cancel-box[open] > summary { margin-bottom: .75rem; }

/* ------------------------------------------------------------------------- */
/* Pages publiques                                                           */
/* ------------------------------------------------------------------------- */

.container.medium { max-width: 720px; }
.public-header {
  padding: max(1rem, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) .5rem max(16px, env(safe-area-inset-left));
  max-width: 720px;
  margin: 0 auto;
}
.public-brand img { display: block; width: 200px; max-width: 60vw; height: auto; }
.public-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem;
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem max(16px, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .9rem;
}

.intro {
  margin: 0 0 1.5rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  background: var(--blue-light);
  color: var(--ink);
}
.intro p { margin: 0 0 .75rem; }
.contact { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; margin: 0; padding: 0; list-style: none; }
.contact a { color: #0b3b57; font-weight: 600; }

.choices { display: grid; gap: .75rem; }
.choice {
  display: grid;
  gap: .15rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  color: var(--text);
  text-decoration: none;
}
.choice:hover { background: color-mix(in srgb, var(--blue-light) 40%, var(--surface)); }

details.week {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0 0 .75rem;
  padding: 0 1rem;
}
details.week > summary {
  padding: .9rem 0;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
}
.day { padding: 0 0 1rem; }
.day h2 { font-size: 1rem; color: var(--text); margin: 0 0 .5rem; }
.slots { display: flex; flex-wrap: wrap; gap: .5rem; }
.slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.5rem;
  min-height: 48px;
  padding: .5rem 1rem;
  border-radius: 999px;
  border: 2px solid var(--primary);
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}
.slot:hover, .slot:focus-visible { background: var(--primary); color: var(--primary-ink); }

/* Vue agenda publique : une colonne par jour, empilées sur smartphone */
.agenda-nav { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: 0 0 1rem; }
.agenda-title { margin: 0; font-size: 1.1rem; text-align: center; }
.btn.is-disabled { opacity: .35; pointer-events: none; }
.agenda { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: .6rem; }
.agenda-day {
  display: grid;
  align-content: start;
  gap: .6rem;
  padding: .75rem .5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.agenda-day h3 { display: grid; margin: 0; text-align: center; font-size: .95rem; line-height: 1.3; }
.agenda-day .dow { color: var(--primary); font-weight: 700; }
.agenda-day .dnum { color: var(--muted); font-weight: 400; font-size: .85rem; }
.agenda-day.is-past { opacity: .5; }
.agenda-slots { display: grid; gap: .45rem; }
.agenda-slots .slot { min-width: 0; width: 100%; padding: .4rem .25rem; }
.agenda-empty { margin: 0; text-align: center; font-size: .9rem; }
.view-switch { margin: 1rem 0 0; text-align: center; font-size: .95rem; }

@media (max-width: 640px) {
  .agenda { grid-template-columns: minmax(0, 1fr); }
  .agenda-day h3 { display: block; text-align: left; }
  .agenda-slots { grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); }
}

.summary { display: grid; gap: .2rem; background: var(--blue-light); border-color: transparent; color: var(--ink); }
.summary.is-cancelled { background: var(--pink); }
.badge { justify-self: start; padding: .1rem .6rem; border-radius: 999px; background: var(--red); color: #fff; font-size: .85rem; font-weight: 700; }
.back-link { margin: 1.5rem 0 0; }
.consent { align-items: flex-start; }
.consent input { margin-top: .3rem; }

/* Pot de miel anti-robots : hors écran, ignoré par les lecteurs d'écran */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ------------------------------------------------------------------------- */
/* Éditeur de semaine type                                                   */
/* ------------------------------------------------------------------------- */

.container.wide { max-width: 1320px; }

.week-editor {
  display: grid;
  gap: 1rem;
  grid-template-columns: 210px minmax(0, 1fr);
  align-items: start;
}
.palette { position: sticky; top: 1rem; display: grid; gap: .6rem; }
.palette-title { font-size: 1rem; margin: 0; }
.palette-items { display: grid; gap: .5rem; }
.palette-item {
  display: grid;
  padding: .5rem .75rem;
  border-radius: 10px;
  border-left: 5px solid var(--c);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  line-height: 1.3;
}
.palette-item:active { cursor: grabbing; }

@media (max-width: 760px) {
  .week-editor { grid-template-columns: minmax(0, 1fr); }
  .palette { position: static; }
  .palette-items { display: flex; overflow-x: auto; padding-bottom: .25rem; }
  .palette-item { flex: none; }
}

.week-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.week-grid {
  display: grid;
  grid-template-columns: 3.5rem repeat(7, minmax(110px, 1fr));
  grid-template-rows: auto var(--grid-height);
  min-width: 840px;
}
.week-corner, .week-dayname {
  padding: .6rem .25rem;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  text-align: center;
  color: var(--primary);
}
.week-times { position: relative; grid-column: 1; grid-row: 2; }
.week-time { position: absolute; right: .4rem; margin-top: 2px; font-size: .75rem; color: var(--muted); }
.week-col {
  position: relative;
  grid-row: 2;
  border-left: 1px solid var(--line);
  /* Lignes des heures (pleines) et demi-heures (légères) */
  background-image:
    repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 60px),
    repeating-linear-gradient(to bottom, transparent 0 30px, color-mix(in srgb, var(--line) 45%, transparent) 30px 31px, transparent 31px 60px);
}

.block {
  position: absolute;
  left: 4px;
  right: 4px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: .2rem .45rem;
  border-radius: 8px;
  border-left: 4px solid var(--c);
  background: color-mix(in srgb, var(--c) 20%, var(--surface));
  color: var(--text);
  font-size: .8rem;
  line-height: 1.25;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.block-pause {
  background: repeating-linear-gradient(135deg,
    color-mix(in srgb, var(--c) 18%, var(--surface)) 0 6px,
    var(--surface) 6px 12px);
}
.block-time { font-weight: 700; }
.block-title { overflow: hidden; text-overflow: ellipsis; }
.block-place { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .72rem; }
.block-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 14px; cursor: ns-resize; }
.block-resize::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 24px;
  height: 3px;
  margin-left: -12px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--c) 60%, transparent);
}
.block.is-dragging, .block.is-ghost {
  z-index: 3;
  opacity: .85;
  cursor: grabbing;
  box-shadow: 0 6px 18px rgb(0 0 0 / .18);
}
.block:focus-visible { outline: 3px solid var(--orange); outline-offset: 1px; }

.week-status { min-height: 1.6em; margin: .75rem 0 0; color: var(--muted); }
.week-status.is-error { color: var(--danger); font-weight: 600; }

/* ------------------------------------------------------------------------- */
/* Tableau de bord : agenda de la semaine                                    */
/* ------------------------------------------------------------------------- */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.search-form { display: flex; gap: .5rem; margin: 0 0 1rem; }
.search-form input { flex: 1; }
.search-section { margin-top: 2rem; }
.dash-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin: 0 0 .75rem; }
.segmented { display: inline-flex; padding: 3px; border-radius: 999px; background: color-mix(in srgb, var(--blue-light) 50%, var(--surface)); }
.segmented a { padding: .4rem 1rem; border-radius: 999px; color: var(--primary); font-weight: 600; text-decoration: none; }
.segmented a[aria-current="page"] { background: var(--primary); color: var(--primary-ink); }
.dash-grid .week-dayname a { color: inherit; text-decoration: none; display: block; }
.dash-grid .week-dayname a:hover { text-decoration: underline; }
/* Vue jour : une seule colonne qui prend toute la largeur, cartes plus lisibles */
.dash-grid.is-day { grid-template-columns: 3.5rem minmax(0, 1fr); min-width: 0; }
.dash-grid.is-day .ev-card { font-size: .9rem; }
.dash-grid.is-day .bg-block span { font-size: .75rem; }
.dash-grid {
  display: grid;
  grid-template-columns: 3.5rem repeat(var(--cols), minmax(130px, 1fr));
  grid-template-rows: auto var(--grid-height);
  min-width: calc(3.5rem + var(--cols) * 130px);
}
.dash-grid .week-dayname { line-height: 1.25; }
.dash-grid .week-dayname .dnum { color: var(--muted); font-weight: 400; font-size: .85rem; }
.dash-grid .week-dayname.is-today { background: color-mix(in srgb, var(--blue-light) 60%, var(--surface)); }
.dash-grid .week-col.is-today { background-color: color-mix(in srgb, var(--blue-light) 18%, var(--surface)); }
/* Jour fermé intercalé entre deux jours d'ouverture */
.dash-grid .week-dayname.is-closed { color: var(--muted); }
.dash-grid .week-col.is-closed {
  background-image:
    repeating-linear-gradient(135deg, color-mix(in srgb, var(--line) 55%, transparent) 0 6px, transparent 6px 14px),
    repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 60px);
}
.closed-tag { display: block; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* Fond : semaine type */
.bg-block { position: absolute; left: 0; right: 0; padding: .15rem .35rem; overflow: hidden; }
.bg-block span { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.bg-rdv { background: color-mix(in srgb, var(--blue-light) 45%, transparent); }
.bg-cours { background: color-mix(in srgb, var(--orange) 10%, transparent); }
.bg-permanence { background: color-mix(in srgb, var(--blue) 8%, transparent); }
.bg-pause { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--line) 70%, transparent) 0 5px, transparent 5px 10px); }

/* Indisponibilités */
.unav {
  position: absolute; left: 0; right: 0; z-index: 1; padding: .15rem .35rem; overflow: hidden;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--red) 14%, var(--surface)) 0 6px, var(--surface) 6px 12px);
}
.unav span { font-size: .72rem; font-weight: 700; color: var(--danger); }

/* Rendez-vous et séances */
.ev-card {
  position: absolute; left: 4px; right: 4px; z-index: 2;
  display: flex; flex-direction: column; gap: .05rem; overflow: hidden;
  padding: .2rem .45rem; border: 0; border-left: 4px solid var(--c); border-radius: 8px;
  background: color-mix(in srgb, var(--c) 24%, var(--surface));
  color: var(--text); font: inherit; font-size: .78rem; line-height: 1.25; text-align: left; text-decoration: none;
  box-shadow: 0 1px 3px rgb(0 0 0 / .12); cursor: pointer;
}
/* Cartes simultanées (--lanes) côte à côte : chacune 1/n de la colonne */
.dash-grid .ev-card {
  --lane: 0; --lanes: 1;
  left: calc(4px + (100% - 8px) * var(--lane) / var(--lanes));
  right: calc(4px + (100% - 8px) * (var(--lanes) - var(--lane) - 1) / var(--lanes));
  /* Liseré blanc : deux RDV qui se suivent restent bien distincts */
  box-shadow: 0 0 0 1px var(--surface), 0 1px 3px rgb(0 0 0 / .12);
}
.dash-grid .ev-card.is-past { box-shadow: 0 0 0 1px var(--surface); }
.ev-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-card span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.ev-card:hover, .ev-card:focus-visible { background: color-mix(in srgb, var(--c) 36%, var(--surface)); }
.ev-card.is-draft { border-left-style: dashed; opacity: .75; }
/* Passé : cartes grisées, temps écoulé voilé */
/* Grisées, légèrement transparentes (avant : .55, jugé trop fort) */
.ev-card.is-past { filter: grayscale(1); opacity: .8; background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: var(--muted); box-shadow: none; }
.ev-card.is-past:hover, .ev-card.is-past:focus-visible { opacity: 1; background: color-mix(in srgb, var(--c) 28%, var(--surface)); color: var(--text); }
.past-shade { position: absolute; top: 0; left: 0; right: 0; z-index: 1; pointer-events: none; background: color-mix(in srgb, var(--muted) 12%, transparent); }
/* Moment présent */
.now-line { position: absolute; left: 0; right: 0; z-index: 4; height: 2px; margin-top: -1px; background: var(--red); pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.now-line span {
  position: absolute; right: 4px; top: -9px; padding: 0 .35rem; border-radius: 999px;
  background: var(--red); color: #fff; font-size: .7rem; font-weight: 700; line-height: 1.4;
}

.dash-legend { margin: .75rem 0 0; }
.dash-legend .lg { display: inline-block; width: 12px; height: 12px; margin: 0 .25rem 0 .75rem; border-radius: 3px; vertical-align: -1px; border: 1px solid var(--line); }
.dash-legend .lg:first-child { margin-left: 0; }
.lg-rdv { background: color-mix(in srgb, var(--blue-light) 60%, var(--surface)); }
.lg-cours { background: color-mix(in srgb, var(--orange) 15%, var(--surface)); }
.lg-pause { background: repeating-linear-gradient(135deg, var(--line) 0 3px, var(--surface) 3px 6px); }

/* Présences : encodage */
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.row-between h2 { margin: 0; }
.attend-list { display: grid; gap: .25rem; }
.attend-row { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; padding: .55rem .25rem; border-bottom: 1px solid var(--line); }
.attend-row input[type="checkbox"] { width: 1.3rem; height: 1.3rem; }
.walkin-rows { display: grid; gap: .5rem; }
.walkin-row { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.attend-toggle { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.btn-absent { background: var(--danger); color: #fff; }
.ev-card.is-absent strong { text-decoration: line-through; }

/* Fermetures */
.seg-option { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem 1rem; border-radius: 999px; color: var(--primary); font-weight: 600; cursor: pointer; }
.seg-option { position: relative; }
.seg-option input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.seg-option:has(input:checked) { background: var(--primary); color: var(--primary-ink); }
.seg-option:has(input:focus-visible) { outline: 3px solid var(--orange); outline-offset: 2px; }
.swatch-closed { background: repeating-linear-gradient(135deg, var(--red) 0 3px, var(--pink) 3px 6px); }
.holiday-years { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.holiday-years ul { margin: .5rem 0 0; padding-left: 1.2rem; }
.agenda-day.is-closed { background: repeating-linear-gradient(135deg, var(--pink) 0 6px, var(--surface) 6px 12px); }
.closures-public li { margin: .2rem 0; }

/* Rapport */
.report-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin: 0 0 1rem; }
.report-years { margin: 0; gap: .75rem; }
.report-title { margin: .5rem 0 1rem; }
.kpis { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin: 0 0 1.25rem; }
.kpi { display: grid; gap: .1rem; padding: 1rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.kpi-main { background: var(--blue-light); border-color: transparent; color: var(--ink); }
.kpi-value { font-size: 2rem; font-weight: 800; line-height: 1.1; color: var(--primary); }
.kpi-main .kpi-value { color: #0b3b57; }
.kpi-label { font-size: .9rem; }
.kpi-label small { color: var(--muted); }
.bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; align-items: end; height: 200px; margin: 0 0 .5rem; }
.bar-group { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: .35rem; color: var(--text); text-decoration: none; }
.bar-pair { display: flex; align-items: flex-end; justify-content: center; gap: 6px; height: 100%; }
.bar { position: relative; width: min(42px, 40%); min-height: 2px; border-radius: 6px 6px 0 0; }
.bar b { position: absolute; top: -1.35rem; left: 0; right: 0; text-align: center; font-size: .8rem; }
.bar-visits { background: var(--primary); }
.bar-unique { background: var(--orange); }
.bar-label { text-align: center; font-weight: 700; }
.bar-group.is-current .bar-label { color: var(--primary); text-decoration: underline; }
.bar-group:not(.is-current) .bar { opacity: .55; }
.bar-legend .lg { display: inline-block; width: 12px; height: 12px; margin: 0 .25rem 0 .75rem; border-radius: 3px; vertical-align: -1px; }
.bar-legend .lg:first-child { margin-left: 0; }
.report-table td, .report-table th { text-align: right; }
.report-table th[scope="row"], .report-table thead th:first-child { text-align: left; }
.report-table .is-current { background: color-mix(in srgb, var(--blue-light) 45%, transparent); }
.sessions-table .num { text-align: right; white-space: nowrap; }
.sessions-table tfoot th { border-top: 2px solid var(--line); border-bottom: 0; }
.print-only { display: none; }
@media print { .print-only { display: inline; } }
.presence-list > summary { cursor: pointer; list-style: none; }
.presence-list > summary::-webkit-details-marker { display: none; }
.presence-list > summary h2 { display: inline; }
@media print {
  .admin .topbar, .admin .subnav, .admin script { display: none !important; }
  .admin .container { max-width: none; padding: 0; }
  .admin .card { break-inside: avoid; }
  .admin h1 { display: none; }
}

/* Fenêtre modale */
.dialog {
  width: min(540px, calc(100vw - 32px));
  border: 0;
  border-radius: var(--radius);
  padding: 1.25rem;
  background: var(--surface);
  color: var(--text);
}
.dialog::backdrop { background: rgb(0 0 0 / .4); }
fieldset.types { display: grid; gap: .4rem; border: 1px solid var(--line); border-radius: 10px; padding: .75rem; margin: 0; }
fieldset.types[hidden] { display: none; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
.check input { width: auto; }

/* Liste à copier (nouveaux contacts Brevo) */
.copy-box { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; resize: vertical; }
#sans-nom input[type="text"] { min-width: 8rem; }

/* Recherche : historique des passages d'une personne */
.history summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: .25rem .5rem; align-items: baseline; }
.history .table { margin-top: .75rem; }
.history tr.muted td { color: var(--muted, #6b7280); }

/* Bouton « aujourd'hui » façon page de calendrier, centré entre les vues et les actions */
.dash-tools { display: grid; grid-template-columns: 1fr auto 1fr; }
.dash-tools > .actions { justify-self: end; }
.dash-tools > .segmented { justify-self: start; }
.today-btn {
  display: grid; justify-items: center; width: 48px; overflow: hidden;
  border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line), 0 1px 2px rgb(0 0 0 / .08);
  background: var(--surface); color: var(--text); text-decoration: none; line-height: 1.1;
}
.today-month { width: 100%; padding: 2px 0; background: var(--red); color: #fff; font-size: .62rem; font-weight: 700; text-align: center; text-transform: uppercase; }
.today-day { padding: 2px 0 4px; font-size: 1.2rem; font-weight: 800; }
.today-btn:hover { box-shadow: inset 0 0 0 2px var(--primary); }
.today-btn.is-current { opacity: .6; }
@media (max-width: 560px) {
  .dash-tools { grid-template-columns: auto auto; }
  .dash-tools > .actions { grid-column: 1 / -1; justify-self: stretch; }
}

/* « + RDV » : suggestions de visiteurs connus */
.suggest-wrap { position: relative; }
.suggest {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 10; margin: 4px 0 0; padding: 4px; list-style: none;
  max-height: 320px; overflow-y: auto; border-radius: 10px; background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), 0 8px 24px rgb(0 0 0 / .14);
}
.suggest li { display: grid; padding: .45rem .7rem; border-radius: 8px; cursor: pointer; line-height: 1.3; }
.suggest li:hover, .suggest li.is-active { background: color-mix(in srgb, var(--blue-light) 55%, var(--surface)); }

/* « + RDV » : créneaux libres du jour choisi */
.free-slots p { margin: 0 0 .4rem; }
.free-slots .slot { min-width: 4.5rem; min-height: 40px; padding: .3rem .8rem; background: none; font: inherit; font-weight: 700; cursor: pointer; }
.free-slots .slot.is-picked { background: var(--primary); color: var(--primary-ink); }

/* Agenda admin : créneau libre, cliquable pour ajouter un RDV */
.free-slot {
  position: absolute; left: 4px; right: 4px; z-index: 2; display: flex; align-items: flex-start;
  padding: .2rem .45rem; border: 1.5px dashed color-mix(in srgb, var(--primary) 45%, transparent); border-radius: 8px;
  background: color-mix(in srgb, var(--blue-light) 25%, var(--surface)); /* opaque : masque le libellé de la plage */
  color: color-mix(in srgb, var(--primary) 75%, var(--surface)); font-size: .75rem; font-weight: 700; text-decoration: none;
}
.free-slot:hover, .free-slot:focus-visible { color: var(--primary); border-style: solid; background: color-mix(in srgb, var(--blue-light) 55%, var(--surface)); }
.free-slots .day-chips { margin-bottom: .75rem; }
.free-slots .day-chips .slot { min-width: 0; font-weight: 600; text-transform: capitalize; }

/* Session démo */
.demo-banner { margin: 0; padding: .45rem 16px; background: var(--yellow); color: var(--ink); font-size: .85rem; font-weight: 600; text-align: center; }

/* Petite corbeille en bout de ligne (désinscrire) */
.row-action { width: 1%; text-align: right; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover, .icon-btn:focus-visible { background: var(--pink); color: var(--danger); }

/* Double authentification */
.code-input { max-width: 12rem; font-size: 1.4rem; letter-spacing: .2em; text-align: center; font-variant-numeric: tabular-nums; }
.steps { display: grid; gap: .9rem; padding-left: 1.3rem; }
.qr { width: 200px; margin: .6rem 0; padding: 6px; border-radius: 10px; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.qr svg { display: block; width: 100%; height: auto; }
.totp-key { display: inline-block; margin-top: .3rem; padding: .2rem .5rem; border-radius: 6px; background: var(--blue-light); color: var(--ink); font-size: 1rem; letter-spacing: .08em; user-select: all; }
.totp-confirm { max-width: 20rem; }

/* Vie privée : liste des protections */
.protections { display: grid; gap: .7rem; padding-left: 1.2rem; }
.protections li::marker { color: var(--primary); }

/* Réglages : logo de l'installation */
.logo-setting { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.logo-preview { max-width: 180px; max-height: 70px; object-fit: contain; padding: .5rem; border: 1px solid var(--line, #dde3ea); border-radius: 8px; background: #fff; }

/* Cours : légende des couleurs (type de séance) */
.type-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; margin: .5rem 0; }
.type-legend > span { display: inline-flex; align-items: center; gap: .35rem; }
.type-legend .swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* Tableau de bord : vue mois (remplissage) */
.month-summary { margin: .5rem 0 .75rem; }
.month-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 4px; }
.month-dow { font-size: .8rem; font-weight: 600; color: #5b6b7a; text-align: center; padding: .25rem 0; }
.month-cell { display: flex; flex-direction: column; gap: .3rem; min-height: 92px; padding: .45rem .5rem; border: 1px solid #dde3ea;
  border-radius: 8px; background: #fff; color: inherit; text-decoration: none; }
.month-cell:hover { border-color: #0067a1; }
.month-cell.is-out { opacity: .35; }
.month-cell.is-past { background: #f6f8fa; opacity: .5; }
.month-cell.is-past:hover, .month-cell.is-past:focus-visible { opacity: 1; }
.month-cell.is-today { border: 2px solid #0067a1; }
.month-cell.is-closed { background: repeating-linear-gradient(135deg, #f3f5f7 0 6px, #fff 6px 12px); }
.month-day { font-weight: 700; font-size: .95rem; }
.month-closed, .month-count, .month-course { font-size: .78rem; color: #5b6b7a; }
.month-course { display: block; padding: .3rem .45rem; border-left: 4px solid var(--c); border-radius: 5px;
  background: color-mix(in srgb, var(--c) 16%, #fff); color: #1f2d3a; line-height: 1.25; }
.month-course strong { display: block; font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.month-course span { font-size: .74rem; color: #44525f; }
.fill { display: block; height: 8px; border-radius: 4px; background: #e6edf3; overflow: hidden; }
.fill > span { display: block; height: 100%; width: var(--pct); border-radius: 4px; background: #7fb3d1; }
.fill-mid > span { background: #3d8bbd; }
.fill-high > span { background: #0067a1; }
.fill-full > span { background: #003f63; }
.month-dow-inline { display: none; }
.month-count-short { display: none; }
/* Mobile : la grille du mois reste, en version compacte */
@media (max-width: 700px) {
  .month-grid { gap: 3px; }
  .month-dow { font-size: .72rem; }
  .month-cell { gap: .2rem; min-height: 74px; padding: .3rem; border-radius: 6px; }
  .month-day { font-size: .85rem; }
  .fill { height: 5px; }
  .month-count { display: none; }
  .month-count-short { display: block; font-size: .68rem; color: #5b6b7a; }
  .month-closed { font-size: .68rem; }
  .month-course { padding: .2rem .3rem; border-left-width: 3px; border-radius: 4px; }
  .month-course strong { font-size: .68rem; font-weight: 700; white-space: normal;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .month-course strong .t { display: none; }
  .month-course span { font-size: .64rem; }
}

/* Accueil public : petit agenda du mois (vert = libre, rouge = complet, gris = fermé) */
.mini-cal { max-width: 340px; margin: 0 auto 1.25rem; padding: .75rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.mini-cal-head { display: grid; grid-template-columns: 2rem 1fr 2rem; align-items: center; margin-bottom: .4rem; text-align: center; color: var(--primary); }
.mini-cal-head a { display: grid; place-items: center; height: 2rem; border-radius: 8px; font-size: 1.4rem; line-height: 1; text-decoration: none; }
.mini-cal-head a:hover { background: color-mix(in srgb, var(--blue-light) 50%, var(--surface)); }
.mini-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.mini-dow { font-size: .72rem; font-weight: 700; color: var(--muted); text-align: center; }
.mini-day { display: grid; place-items: center; aspect-ratio: 1; border-radius: 8px; font-size: .9rem; font-weight: 600; text-decoration: none; }
.mini-day.is-free { background: #d7f2df; color: #14532d; }
.mini-day.is-full { background: #fbdcdc; color: #8a1f26; }
.mini-day.is-closed, .mini-day.is-off { background: #eceff2; color: #8a949c; font-weight: 400; }
.mini-day.is-off { opacity: .55; }
.mini-day.is-out { visibility: hidden; }
a.mini-day:hover, a.mini-day:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.mini-day.is-week { box-shadow: inset 0 0 0 2px var(--primary); }
.mini-day.is-today { text-decoration: underline; text-underline-offset: 3px; }
.mini-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem .9rem; margin: .6rem 0 0; font-size: .78rem; color: var(--muted); }
.mini-legend .lg { display: inline-block; width: 11px; height: 11px; margin-right: .3rem; border-radius: 3px; vertical-align: -1px; }
.mini-legend .is-free { background: #d7f2df; box-shadow: inset 0 0 0 1px #8fd3a6; }
.mini-legend .is-full { background: #fbdcdc; box-shadow: inset 0 0 0 1px #eba3a3; }
.mini-legend .is-closed { background: #eceff2; box-shadow: inset 0 0 0 1px #c9cfd4; }
.mini-legend .is-week { background: transparent; box-shadow: inset 0 0 0 2px var(--primary); }
.mini-day.is-today { background: #003f63; color: #fff; font-weight: 700; text-decoration: none; opacity: 1; }
.mini-day.is-today.is-week { box-shadow: inset 0 0 0 2px var(--primary), inset 0 0 0 4px #fff; }
.mini-legend .is-today { background: #003f63; }
/* Petit agenda : une ligne par semaine, la semaine affichée encadrée en entier */
.mini-cal-grid { display: grid; grid-template-columns: 1fr; gap: 2px; }
.mini-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 3px; border-radius: 11px; }
.mini-week.is-current { box-shadow: inset 0 0 0 2px var(--primary); }
.mini-day.is-week, .mini-day.is-today.is-week { box-shadow: none; }
.mini-legend > span { white-space: nowrap; }

/* Accueil public, vue agenda : petit agenda à gauche, créneaux de la semaine à droite (desktop) */
.agenda-hint { margin: -.25rem 0 1rem; text-align: center; color: var(--muted); }
@media (min-width: 760px) {
  .agenda-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
  .agenda-layout .mini-cal { position: sticky; top: 1rem; max-width: none; margin: 0; }
  /* Colonne étroite : les jours s'empilent, créneaux en ligne */
  .agenda-layout .agenda { grid-template-columns: minmax(0, 1fr); }
  .agenda-layout .agenda-day h3 { display: block; text-align: left; }
  .agenda-layout .agenda-slots { grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr)); }
}
