/* Alter Finder — ambiance "veilleuse" : nuit violette, lueur pêche.
   Pensé pour être lisible et apaisant même en pleine dissociation. */

:root {
  --night:   #221c2e;
  --surface: #2d2540;
  --line:    #3d3355;
  --mist:    #ede8f6;
  --faded:   #a79bc2;
  --peach:   #f0a98c;
  --sage:    #93c7a5;
  --rose:    #dd97ac;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--night);
  color: var(--mist);
  font-family: "Atkinson Hyperlegible", system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.55;
  min-height: 100vh;
}

h1, h2, .display {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  letter-spacing: 0.01em;
}

a { color: var(--peach); }

/* ---------- Coquille commune ---------- */
.shell {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 4px;
  font-size: 15px;
  color: var(--faded);
}
.topbar a { text-decoration: none; margin-left: 16px; }
.brand { font-family: "Fraunces", serif; font-size: 17px; color: var(--mist); }
.brand::before { content: "🐾 "; }

/* ---------- Boutons ---------- */
button {
  font-family: inherit;
  font-size: 18px;
  color: var(--mist);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 20px;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease;
}
button:hover { border-color: var(--peach); }
button:active { transform: scale(.98); }
button:focus-visible { outline: 3px solid var(--peach); outline-offset: 2px; }
button.primary { background: var(--peach); color: #33221a; border: none; font-weight: 700; }
button.ghost { background: transparent; color: var(--faded); border-color: transparent; font-size: 15px; }
button.ghost:hover { color: var(--mist); }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
}
.card h1 { font-size: 26px; margin-bottom: 6px; }
.card p.sub { color: var(--faded); font-size: 15px; margin-bottom: 26px; }
label { display: block; font-size: 15px; color: var(--faded); margin: 16px 0 6px; }
input, select, textarea {
  width: 100%;
  font-family: inherit;
  font-size: 17px;
  color: var(--mist);
  background: var(--night);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--peach);
  border-color: transparent;
}
.error { color: var(--rose); font-size: 15px; margin-top: 14px; min-height: 1.4em; }

/* ---------- Quiz ---------- */
.quiz-stage {
  min-height: 72vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 34px;
  text-align: center;
}
.q-number { color: var(--faded); font-size: 15px; letter-spacing: .08em; text-transform: uppercase; }
.q-text {
  font-family: "Fraunces", serif;
  font-size: clamp(28px, 6vw, 40px);
  line-height: 1.25;
  position: relative;
}
/* la "veilleuse" : halo qui respire doucement derrière la question */
.q-text::before {
  content: "";
  position: absolute;
  inset: -40px -20px;
  background: radial-gradient(ellipse at center, rgba(240,169,140,.14), transparent 70%);
  z-index: -1;
  animation: breathe 6s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: .5; transform: scale(1); }
  50%      { opacity: 1;  transform: scale(1.06); }
}
@media (prefers-reduced-motion: reduce) {
  .q-text::before { animation: none; }
}

.answers { display: flex; flex-direction: column; gap: 12px; }
.answers button { font-size: 19px; padding: 16px; }
.answers .a-oui        { border-left: 6px solid var(--sage); }
.answers .a-plutot_oui { border-left: 6px solid color-mix(in srgb, var(--sage) 55%, var(--surface)); }
.answers .a-jsp        { border-left: 6px solid var(--line); }
.answers .a-plutot_non { border-left: 6px solid color-mix(in srgb, var(--rose) 55%, var(--surface)); }
.answers .a-non        { border-left: 6px solid var(--rose); }

/* ---------- Résultats ---------- */
.result-title { font-size: 24px; text-align: center; margin-bottom: 8px; }
.result-sub { text-align: center; color: var(--faded); font-size: 15px; margin-bottom: 24px; }
.candidate {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 10px;
}
.candidate:first-of-type {
  border-color: var(--peach);
  box-shadow: 0 0 24px rgba(240,169,140,.12);
}
.candidate .name { font-family: "Fraunces", serif; font-size: 22px; }
.candidate .pct { color: var(--faded); font-size: 15px; white-space: nowrap; }
.candidate .notes { color: var(--faded); font-size: 14px; width: 100%; }
.candidate-wrap .candidate { flex-wrap: wrap; }
.result-actions { display: flex; gap: 12px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }

/* ---------- Admin ---------- */
.admin-grid { display: grid; gap: 28px; }
.list-head { display: flex; gap: 10px; margin-bottom: 14px; }
.list-head input { flex: 1; }
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
}
.row .actions { display: flex; gap: 8px; }
.row .actions button { font-size: 14px; padding: 6px 12px; border-radius: 8px; }

/* Sector — état de la carte directement dans Admin > Alters */
.admin-card-state {
  margin-left: auto;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  flex: 0 0 auto;
}
.admin-card-state.pending { color: var(--peach); }
.admin-card-state.redo { color: #ffb454; }
.admin-card-state.done { color: var(--sage); }
.admin-card-state.blocked { color: var(--rose); }
.admin-page-link-slot {
  display: flex;
  justify-content: center;
  flex: 0 0 auto;
}
.admin-page-link {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid color-mix(in srgb, var(--sage) 48%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--sage) 8%, var(--surface));
  color: var(--sage);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.admin-page-link:hover,
.admin-page-link:focus-visible {
  border-color: var(--sage);
  filter: brightness(1.12);
}
#alterList .row:not(.has-tree-presence) .admin-page-link-slot { margin-left: auto; }
#alterList .row:not(.has-tree-presence) .admin-card-state { margin-left: 0; }

@media (max-width: 620px) {
  #alterList .row:not(.has-tree-presence) { flex-wrap: wrap; }
  #alterList .row:not(.has-tree-presence) .admin-card-state {
    order: 3;
    width: 100%;
    margin-left: 52px;
    padding-left: 0;
  }
}
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 14px; color: var(--faded); font-size: 15px; }
.attr-block { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 14px; }
.attr-block h3 { font-size: 17px; margin-bottom: 4px; }
.attr-block .q { color: var(--faded); font-size: 14px; margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--night);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 14px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.chip button { border: none; background: none; color: var(--rose); font-size: 14px; padding: 0; }
.form-grid { display: grid; gap: 4px; }
.alter-page-url-field {
  display: grid;
  gap: 7px;
  margin: 12px 0 20px;
}
.alter-page-url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.alter-page-url-open {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid color-mix(in srgb, var(--sage) 48%, var(--line));
  border-radius: 11px;
  color: var(--sage);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.alter-page-url-open[hidden] { display: none; }
.alter-page-url-open:hover,
.alter-page-url-open:focus-visible { border-color: var(--sage); filter: brightness(1.12); }
.alter-no-page-link {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: fit-content;
  margin-top: 3px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
}
.alter-no-page-link input { margin-top: 3px; }
.alter-no-page-link span { display: grid; gap: 2px; }
.alter-no-page-link small { color: var(--faded); font-weight: 400; }
.alter-no-page-link:has(input:checked) { border-color: var(--sage); }
dialog {
  background: var(--surface);
  color: var(--mist);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  width: min(560px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
}
dialog::backdrop { background: rgba(15, 11, 22, .75); }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.ok { color: var(--sage); font-size: 15px; min-height: 1.4em; margin-top: 10px; }

/* ---------- Correctif : les sections masquées le sont vraiment ---------- */
[hidden] { display: none !important; }

/* ---------- Candidats cliquables ---------- */
.candidate { cursor: pointer; transition: transform .12s ease, border-color .12s ease; }
.candidate:hover { border-color: var(--peach); transform: translateY(-1px); }

/* ---------- Fiche d'alter ---------- */
.sheet {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  margin-top: 10px;
}
.sheet-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.sheet-photo {
  width: 120px; height: 120px;
  border-radius: 20px;
  object-fit: cover;
  border: 2px solid var(--peach);
  background: var(--night);
}
.sheet-photo.placeholder {
  display: grid; place-items: center;
  font-size: 48px;
  border-color: var(--line);
}
.sheet-head h2 { font-size: 30px; }
.sheet-notes { color: var(--faded); margin-top: 6px; font-size: 16px; }
.sheet-attrs { margin-top: 24px; display: grid; gap: 8px; }
.sheet-attr {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 10px 14px;
  background: var(--night);
  border-radius: 10px;
  font-size: 16px;
}
.sheet-attr .k { color: var(--faded); }
.sheet-empty { color: var(--faded); font-size: 15px; margin-top: 18px; }


/* ---------- Miniatures dans la liste des alters ---------- */
.row { align-items: center; }
.row .who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row-thumb {
  width: 40px; height: 40px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.row-thumb.placeholder {
  display: grid; place-items: center;
  background: var(--night);
  font-size: 18px;
}

/* ---------- Centrage des boîtes de dialogue ----------
   (le reset global * { margin: 0 } annulait le centrage natif) */
dialog { margin: auto; }

/* ---------- Paws, le loup gardien du site ---------- */
.brand::before { content: none; } /* remplacé par le vrai logo */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
}
.card-logo {
  width: 84px; height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--peach);
  display: block;
  margin: 0 auto 16px;
}
.corner-paws {
  position: fixed;
  bottom: 18px; right: 18px;
  width: 74px; height: 74px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--line);
  opacity: .85;
  pointer-events: none; /* ne gêne jamais les clics */
  z-index: 5;
}
@media (max-width: 720px) {
  .corner-paws { width: 54px; height: 54px; bottom: 12px; right: 12px; }
}

/* ---------- Choix multiples dans la fiche d'alter ---------- */
.hint { color: var(--faded); font-size: 13px; font-weight: normal; }
.check-group {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 4px;
}
.check {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--night);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 15px;
  cursor: pointer;
  margin: 0;
  user-select: none;
}
.check:has(input:checked) {
  border-color: var(--peach);
  background: color-mix(in srgb, var(--peach) 14%, var(--night));
}
/* Safari/iPad : le style global des champs donne width:100% aux input.
   Sur un checkbox placé dans un flex, WebKit peut alors l'étirer et pousser
   le texte hors de sa pastille. On redonne une taille fixe au contrôle. */
.check input {
  width: 18px;
  height: 18px;
  min-width: 18px;
  flex: 0 0 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--peach);
  cursor: pointer;
}

/* ---------- Dialogue d'alter agrandi, photo en en-tête ---------- */
dialog.dialog-large { width: min(780px, 94vw); }
.dialog-head {
  display: flex; align-items: center; gap: 18px;
  margin-bottom: 18px;
}
.dialog-head h2 { font-size: 26px; }
.dialog-photo {
  width: 92px; height: 92px;
  border-radius: 18px;
  object-fit: cover;
  border: 2px solid var(--peach);
  flex-shrink: 0;
}
.dialog-photo.placeholder {
  display: grid; place-items: center;
  font-size: 38px;
  background: var(--night);
  border-color: var(--line);
}

/* ---------- Colonne gauche de la fiche : carte + emplacement ---------- */
.alter-side-stack {
  width: min(380px, 100%);
  display: grid;
  gap: 14px;
}
.alter-side-stack[hidden] { display: none !important; }

.alter-card-preview-panel,
.alter-location-preview-panel {
  width: 100%;
  padding: 14px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--night) 82%, var(--surface));
  box-shadow: 0 12px 36px rgba(0, 0, 0, .34);
}
.alter-card-preview-panel[hidden],
.alter-location-preview-panel[hidden] { display: none !important; }

.alter-card-preview-title,
.alter-location-preview-title {
  color: var(--faded);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.alter-card-preview-title { margin-bottom: 9px; }
.alter-card-preview-wrap {
  min-height: 390px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 12px;
  background: var(--night);
}
.alter-card-preview-img {
  display: block;
  width: 100%;
  height: auto;
}
.alter-card-preview-loading {
  padding: 18px 14px;
  color: var(--faded);
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
}

.alter-location-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.alter-location-preview-meta {
  margin-top: 4px;
  color: var(--mist);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}
.alter-location-preview-badge {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid color-mix(in srgb, var(--rose) 60%, var(--line));
  border-radius: 11px;
  background: color-mix(in srgb, var(--rose) 12%, var(--surface));
  font-size: 17px;
}
.alter-location-preview-visual {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 0;
  max-height: 300px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  border-radius: 12px;
  background: var(--night);
}
.alter-location-preview-status {
  max-width: 380px;
  padding: 22px 16px;
  color: var(--faded);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}
.alter-location-preview-svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 300px;
  background: var(--night);
}
.alter-location-preview-map-image {
  opacity: .7;
  filter: brightness(.72) saturate(.9);
}
.alter-location-preview-zone {
  --placement-zone-color: var(--rose);
  fill: color-mix(in srgb, var(--placement-zone-color) 34%, transparent);
  stroke: var(--placement-zone-color);
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--placement-zone-color) 62%, transparent));
}

/* Desktop large : la colonne de gauche est hors de la zone scrollable.
   La carte d'identité et la capture de l'emplacement restent donc visibles
   pendant qu'on descend dans les questions de l'alter. */
@media (min-width: 1700px) {
  .alter-side-stack-left {
    position: absolute;
    right: calc(100% + 18px);
    top: 0;
    width: clamp(320px, 20vw, 380px);
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 3px;
    margin: 0;
    z-index: 6;
    scrollbar-width: thin;
  }
  body[data-system="sector"] #alterDialog.dialog-large {
    width: min(820px, calc(100vw - 700px));
  }
}

/* Sur les écrans plus étroits, les aperçus repassent au-dessus de la fiche
   pour ne jamais recouvrir les champs. */
@media (max-width: 1699px) {
  .alter-side-stack-left {
    position: static;
    width: auto;
    margin: 0 28px 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .alter-card-preview-wrap { min-height: 300px; }
}

@media (max-width: 760px) {
  .alter-side-stack-left {
    margin: 0 20px 14px;
    grid-template-columns: 1fr;
  }
}

/* ---------- Récap du mapping dans la fiche d'un alter ---------- */
#alterDialog.dialog-large { width: min(1060px, 96vw); }
.alter-dialog-head {
  align-items: flex-start;
  justify-content: flex-start;
  gap: 26px;
}
.alter-dialog-identity {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  flex: 1 1 auto;
}

/* Le récap reste hors de la zone scrollable de la fiche : il ne bouge donc pas
   quand on descend dans les questions de l'alter. */
.alter-mapping-recap {
  position: absolute;
  left: calc(100% + 18px);
  top: 0;
  width: 285px;
  max-height: min(72vh, 620px);
  overflow-y: auto;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--night) 82%, var(--surface));
  box-shadow: 0 12px 36px rgba(0, 0, 0, .34);
  z-index: 6;
}
.alter-mapping-recap-title {
  color: var(--faded);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 7px;
}
.alter-mapping-recap-list {
  display: grid;
  grid-template-columns: 1fr;
}
.alter-mapping-recap-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 32px;
  padding: 4px 0;
  border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}
.alter-mapping-recap-row:first-child { border-top: 0; }
.alter-mapping-recap-label {
  min-width: 0;
  color: var(--mist);
  font-size: 13px;
  line-height: 1.25;
}
.alter-mapping-recap-state {
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.alter-mapping-recap-state.is-ok { color: var(--sage); }
.alter-mapping-recap-state.is-todo { color: var(--peach); }

/* Sous 1500 px, le récap repasse lui aussi dans le flux pour éviter de
   chevaucher la fiche centrale. */
@media (max-width: 1699px) {
  #alterDialog.dialog-large { width: min(940px, 96vw); }
  .dialog-body { padding-bottom: 20px; }
  .alter-mapping-recap {
    position: static;
    width: auto;
    max-height: none;
    margin: 16px 28px 0;
    overflow: visible;
  }
}

@media (max-width: 560px) {
  .alter-mapping-recap { margin: 12px 20px 0; }
}

.check span { white-space: nowrap; } /* fini les pastilles qui se plient */

/* ---------- Félicitations & compteur de fronts ---------- */
.congrats {
  background: color-mix(in srgb, var(--sage) 16%, var(--surface));
  border: 1px solid var(--sage);
  border-radius: 16px;
  padding: 18px 22px;
  margin-bottom: 14px;
  font-family: "Fraunces", serif;
  font-size: 22px;
  text-align: center;
}
.congrats .found-count {
  display: block;
  font-family: "Atkinson Hyperlegible", sans-serif;
  font-size: 14px;
  color: var(--faded);
  margin-top: 6px;
}
.found-badge {
  color: var(--faded);
  font-size: 13px;
  margin-left: 8px;
}

/* ---------- Ligne compteur dans le dialogue ---------- */
.found-line { color: var(--faded); font-size: 14px; margin-top: 4px; }

/* ---------- Sous-questions ---------- */
.sub-block {
  margin: 14px 0 0 22px;
  border-left: 3px solid var(--peach);
  background: color-mix(in srgb, var(--peach) 5%, var(--surface));
}
.sub-tag { color: var(--peach); font-size: 14px; font-family: "Atkinson Hyperlegible", sans-serif; }
.sub-attr {
  margin-left: 22px;
  padding-left: 14px;
  border-left: 3px solid var(--peach);
}

/* Flèche de sous-question en tête de pastille, bien distincte de la croix */
.chip .sub-add { color: var(--peach); font-size: 15px; }

/* ---------- La bulle de Paws ---------- */
.paws-bubble {
  position: fixed;
  bottom: 100px; right: 20px;
  max-width: 240px;
  background: var(--surface);
  border: 1px solid var(--peach);
  border-radius: 16px 16px 4px 16px;
  padding: 12px 16px;
  font-size: 15px;
  line-height: 1.4;
  z-index: 6;
  box-shadow: 0 4px 24px rgba(0, 0, 0, .35);
}
.paws-bubble.pop { animation: bubble-pop .25s ease-out; }
@keyframes bubble-pop {
  from { opacity: 0; transform: translateY(8px) scale(.96); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .paws-bubble.pop { animation: none; }
}
@media (max-width: 720px) {
  .paws-bubble { bottom: 74px; right: 14px; max-width: 190px; font-size: 14px; }
}

/* ---------- La devinette ---------- */
.guess-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.guess-photo {
  width: 150px; height: 150px;
  border-radius: 26px;
  object-fit: cover;
  border: 3px solid var(--peach);
  box-shadow: 0 0 40px rgba(240, 169, 140, .2);
}
.guess-photo.placeholder {
  display: grid; place-items: center;
  font-size: 56px;
  background: var(--surface);
  border-color: var(--line);
}
.guess-pct { color: var(--faded); font-size: 15px; }

/* ---------- Bouton de sourdine ---------- */
.sound-toggle {
  background: none;
  border: none;
  font-size: 17px;
  padding: 2px 6px;
  margin-left: 14px;
  cursor: pointer;
  opacity: .8;
}
.sound-toggle:hover { opacity: 1; border-color: transparent; }

/* ---------- Notifications système de la messagerie ---------- */
.notification-toggle {
  background: none;
  border: none;
  font-size: 17px;
  padding: 2px 6px;
  margin-left: 4px;
  cursor: pointer;
  opacity: .58;
  filter: grayscale(.35);
}
.notification-toggle:hover { opacity: 1; border-color: transparent; }
.notification-toggle.is-active { opacity: 1; filter: none; }
.notification-toggle.is-unavailable { opacity: .38; cursor: help; }

/* ---------- Barre de filtres de l'admin ---------- */
.list-head.filters { flex-wrap: wrap; gap: 8px; }
.list-head.filters select { font-size: 15px; padding: 9px 12px; }
.list-head.filters #filterSelect { flex: 1; min-width: 180px; }

/* ═══════════ PAGE STATISTIQUES ═══════════ */
.shell-wide { max-width: 900px; }
.shell-wide section { margin-top: 42px; }
.section-sub { color: var(--faded); font-size: 15px; margin: 6px 0 20px; }
.empty-note { color: var(--faded); font-size: 15px; padding: 18px 0; }

/* Chiffres clés */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 10px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
}
.stat-num {
  display: block;
  font-family: "Fraunces", serif;
  font-size: 34px;
  color: var(--peach);
  line-height: 1.1;
}
.stat-lab { color: var(--faded); font-size: 14px; }

/* Podium */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}
.pod {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 170px;
  text-align: center;
}
.pod-medal { font-size: 26px; }
.pod-photo {
  width: 84px; height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--line);
  margin: 6px 0 8px;
}
.pod-1 .pod-photo { width: 104px; height: 104px; border-color: var(--peach); box-shadow: 0 0 30px rgba(240,169,140,.25); }
.pod-2 .pod-photo { border-color: #c9c9d6; }
.pod-3 .pod-photo { border-color: #c09070; }
.pod-photo.placeholder { display: grid; place-items: center; font-size: 34px; background: var(--surface); }
.pod-name { font-family: "Fraunces", serif; font-size: 18px; line-height: 1.2; }
.pod-count { color: var(--faded); font-size: 14px; margin-bottom: 8px; }
.pod-step {
  width: 100%;
  border-radius: 12px 12px 0 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: none;
}
.pod-1 .pod-step { height: 92px; background: color-mix(in srgb, var(--peach) 22%, var(--surface)); border-color: var(--peach); }
.pod-2 .pod-step { height: 64px; }
.pod-3 .pod-step { height: 44px; }

/* Donuts */
.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 16px;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
}
.chart-card.includes-missing { border-color: color-mix(in srgb, var(--peach) 48%, var(--line)); }
.chart-card-head { display: grid; gap: 10px; align-items: start; }
.chart-card h3 { font-family: "Fraunces", serif; font-size: 18px; margin: 0; }
.chart-missing-toggle {
  width: 100%; padding: 7px 10px; border-radius: 10px;
  background: color-mix(in srgb, var(--night) 72%, var(--surface));
  border-color: var(--line); color: var(--faded); font-size: 12px;
}
.chart-missing-toggle:hover:not(:disabled) { color: var(--mist); border-color: var(--peach); }
.chart-missing-toggle.is-active {
  background: color-mix(in srgb, var(--peach) 14%, var(--night));
  border-color: var(--peach); color: var(--mist);
}
.chart-missing-toggle:disabled { opacity: .55; cursor: default; }
.chart-answer-coverage { margin: 9px 0 4px; color: var(--sage); font-size: 12px; text-align: center; }
.chart-answer-coverage.has-missing { color: #d9a86c; }
.donut { width: 160px; height: 160px; display: block; margin: 0 auto 12px; }
.donut-empty {
  width: 160px; height: 160px; margin: 0 auto 12px;
  border: 26px solid color-mix(in srgb, var(--line) 60%, transparent);
  border-radius: 50%; display: grid; place-content: center; text-align: center;
}
.donut-empty strong { font-family: "Fraunces", serif; font-size: 26px; line-height: 1; }
.donut-empty span { color: var(--faded); font-size: 11px; }
.donut-seg { transition: opacity .15s ease; }
.donut:hover .donut-seg { opacity: .45; }
.donut .donut-seg:hover { opacity: 1; }
.donut-coverage-track { opacity: .8; }
.donut-coverage-missing { transition: opacity .15s ease; }
.donut-coverage-missing:hover { opacity: .72; }
.donut-num { fill: var(--mist); font-family: "Fraunces", serif; font-size: 26px; }
.donut-cap { fill: var(--faded); font-size: 11px; }
.legend { list-style: none; display: grid; gap: 6px; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.legend .dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.legend .lg-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.legend .lg-name small { display: block; color: var(--faded); font-size: 10px; }
.legend .lg-num { color: var(--faded); white-space: nowrap; font-size: 13px; }
.legend-missing { margin-top: 3px; padding-top: 7px; border-top: 1px solid var(--line); }
.chart-empty-note { padding: 4px 0 0; text-align: center; }

/* Classement */
.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
}
.rank-pos { width: 26px; color: var(--faded); font-size: 14px; text-align: right; }
.rank-thumb { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); flex-shrink: 0; }
.rank-thumb.placeholder { display: grid; place-items: center; background: var(--surface); font-size: 17px; }
.rank-name { flex: 1; font-size: 16px; min-width: 120px; }
.rank-note { display: block; color: var(--faded); font-size: 13px; }
.rank-bar { flex: 1.2; height: 8px; background: var(--night); border-radius: 999px; overflow: hidden; min-width: 60px; }
.rank-bar span { display: block; height: 100%; background: var(--peach); border-radius: 999px; }
.rank-num { color: var(--faded); font-size: 15px; width: 34px; text-align: right; }

@media (max-width: 620px) {
  .pod { width: 120px; }
  .rank-bar { display: none; }
}

/* Sous-titre de sous-question dans les graphiques */
.chart-parent {
  display: block;
  font-family: "Atkinson Hyperlegible", sans-serif;
  font-size: 13px;
  color: var(--peach);
  margin-top: 2px;
}

/* ---------- Filtres actifs ---------- */
.active-filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 12px;
}
.filter-chip {
  background: color-mix(in srgb, var(--peach) 14%, var(--night));
  border-color: var(--peach);
}
.filter-chip .fc-attr { color: var(--faded); font-size: 12px; }

/* ---------- Recadrage de photo ---------- */
#cropDialog { width: min(420px, 94vw); }
.crop-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  background: var(--night);
  border: 1px solid var(--line);
  touch-action: none;
}
#cropCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
#cropCanvas:active { cursor: grabbing; }
/* Repère visuel : le carré arrondi correspond au cadre affiché sur le site.
   Tout ce qui déborde de ce cadre est assombri. */
.crop-mask {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.crop-mask::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 19%;
  border: 2px dashed rgba(240, 169, 140, .6);
  box-shadow: 0 0 0 9999px rgba(18, 13, 25, .72);
}
.crop-zoom {
  width: 100%;
  accent-color: var(--peach);
  padding: 0;
  background: none;
  border: none;
}

/* ---------- Photo éditable au survol ---------- */
.photo-edit {
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: 18px;
}
.photo-edit .dialog-photo { display: block; }
.photo-overlay {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: rgba(20, 15, 28, .62);
  display: grid;
  place-items: center;
  font-size: 30px;
  opacity: 0;
  transition: opacity .16s ease;
  pointer-events: none;
}
.photo-edit:hover .photo-overlay,
.photo-edit:focus-within .photo-overlay { opacity: 1; }
.photo-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 10;
  background: var(--night);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 170px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .45);
}
.photo-menu button {
  background: none;
  border: none;
  border-radius: 9px;
  text-align: left;
  font-size: 15px;
  padding: 9px 12px;
  color: var(--mist);
}
.photo-menu button:hover { background: var(--surface); border-color: transparent; }
.photo-menu button.danger { color: var(--rose); }

.alter-archive-action { color: var(--peach); }
.alter-archive-action.is-restore { color: #8fe3b2; }
.alter-delete-permanent { color: var(--rose); }
.admin-archive-state {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 4px;
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--peach) 58%, var(--line));
  border-radius: 999px;
  color: var(--peach);
  font-size: 12px;
  line-height: 1.2;
}
#alterList .row.is-archived { opacity: .82; }

/* ---------- Barre d'actions flottante au-dessus du dialogue ---------- */
dialog.float-bar {
  background: transparent;
  border: none;
  padding: 0;
  overflow: visible;
  max-height: none;
}
.dialog-inner { position: relative; }
.dialog-body {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  max-height: 78vh;
  overflow-y: auto;
  overflow-x: hidden;
}
.dialog-float {
  position: absolute;
  top: -54px;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  z-index: 5;
}
.dialog-float .error {
  margin: 0;
  flex: 1;
  min-height: 0;
  font-size: 14px;
  text-align: right;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .7);
}
.dialog-float button {
  font-size: 15px;
  padding: 9px 18px;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .4);
  backdrop-filter: blur(6px);
}
.dialog-float button.ghost {
  background: color-mix(in srgb, var(--surface) 85%, black);
  border-color: var(--line);
  color: var(--mist);
}
@media (max-width: 560px) {
  .dialog-float { top: -46px; gap: 6px; }
  .dialog-float button { font-size: 14px; padding: 8px 12px; }
  .dialog-body { padding: 20px; max-height: 74vh; }
}

/* ---------- Présence dans l'arbre depuis Admin > Alters ---------- */
#alterList .row.has-tree-presence {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(260px, 1.35fr) auto auto;
  align-items: center;
  gap: 18px;
}
#alterList .row.has-tree-presence .who { min-width: 0; }
#alterList .row.has-tree-presence .actions { grid-column: 4; }
.tree-presence {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px 10px;
  flex-wrap: wrap;
  text-align: center;
}
.tree-presence-label {
  color: var(--faded);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}
.tree-presence-systems {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tree-presence-link {
  --tree-chip-color: var(--peach);
  position: relative;
  border: 1px solid var(--tree-chip-color);
  background: color-mix(in srgb, var(--tree-chip-color) 12%, var(--surface));
  color: var(--mist);
  border-radius: 999px;
  padding: 5px 10px 5px 22px;
  font-size: 13px;
  line-height: 1.15;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease, background .12s ease;
}
.tree-presence-link::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tree-chip-color);
  transform: translateY(-50%);
  box-shadow: 0 0 7px color-mix(in srgb, var(--tree-chip-color) 72%, transparent);
}
.tree-presence-link:hover {
  filter: brightness(1.13);
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--tree-chip-color) 20%, var(--surface));
}
.tree-presence-link:focus-visible {
  outline: 2px solid var(--tree-chip-color);
  outline-offset: 2px;
}
.tree-presence-empty .tree-presence-label {
  opacity: .58;
  font-style: italic;
}

@media (max-width: 760px) {
  #alterList .row.has-tree-presence {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
  }
  #alterList .row.has-tree-presence .tree-presence {
    grid-column: 1 / -1;
    justify-content: flex-start;
    text-align: left;
    padding-left: 52px;
  }
  #alterList .row.has-tree-presence .actions {
    grid-column: 2;
    grid-row: 1;
  }
  #alterList .row.has-tree-presence .tree-presence-systems {
    justify-content: flex-start;
  }
  #alterList .row.has-tree-presence .admin-page-link-slot {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-left: 52px;
  }
  .alter-page-url-row { grid-template-columns: 1fr; }
  .alter-page-url-open { width: fit-content; }
}

/* V4.4 — fuseau local des statistiques */
#localTimeNote {
  margin-top: -12px;
  margin-bottom: 20px;
  font-size: 13px;
  opacity: .9;
}

/* ---------- Questions à réponse unique ---------- */
.exclusive-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 8px;
  border: 1px solid var(--peach);
  border-radius: 999px;
  color: var(--peach);
  font-family: "Atkinson Hyperlegible", sans-serif;
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}
.exclusive-option {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  margin-top: 10px;
  cursor: pointer;
}
.exclusive-option input {
  width: auto;
  margin: 0;
  accent-color: var(--peach);
}
.exclusive-help { margin-top: 2px; }


/* ---------- Version de Paws ---------- */
.paws-version {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 120;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, var(--mist) 18%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--night) 84%, transparent);
  color: var(--faded);
  font-family: "Atkinson Hyperlegible", sans-serif;
  font-size: 11px;
  line-height: 1;
  letter-spacing: .02em;
  opacity: .68;
  pointer-events: none;
  user-select: none;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
@media (max-width: 560px) {
  .paws-version {
    left: 8px;
    bottom: 8px;
    padding: 4px 7px;
    font-size: 10px;
    opacity: .58;
  }
}

/* ---------- Réponses manquantes ---------- */
.admin-missing-summary,
.admin-missing-answers {
  grid-column: 1 / -1;
  border-radius: 18px;
  padding: 20px;
  background: color-mix(in srgb, var(--surface) 92%, var(--night));
}
.admin-missing-summary {
  border: 1px solid var(--line);
}
.admin-missing-answers {
  border: none;
  scroll-margin-top: 24px;
}
.admin-missing-summary .section-head,
.admin-missing-answers .section-head { align-items: flex-start; }
.missing-answer-summary-intro,
.missing-answer-intro { margin-bottom: 0; max-width: 820px; }
.section-count { color: var(--faded); font-size: 15px; font-family: "Atkinson Hyperlegible", sans-serif; }

/* Résumé compact placé en haut de l'administration. */
.missing-summary-warning,
.missing-summary-ok {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  color: var(--faded);
}
.missing-summary-warning {
  border: 1px solid color-mix(in srgb, #e79a45 72%, var(--line));
  background: color-mix(in srgb, #e79a45 9%, var(--night));
}
.missing-summary-ok {
  grid-template-columns: auto 1fr;
  border: 1px solid color-mix(in srgb, var(--sage) 45%, var(--line));
  background: color-mix(in srgb, var(--sage) 6%, var(--night));
}
.missing-summary-warning strong,
.missing-summary-ok strong { color: var(--mist); }
.missing-summary-icon { font-size: 20px; }
.missing-summary-copy { display: grid; gap: 3px; min-width: 0; }
.missing-summary-copy > span { font-size: 14px; }
.missing-summary-go { white-space: nowrap; padding: 8px 15px; }

.missing-answer-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.missing-answer-list { display: grid; gap: 8px; margin-top: 16px; }
.missing-answer-alter {
  border: 1px solid var(--line);
  border-left: 4px solid #e79a45;
  border-radius: 14px;
  background: var(--night);
  overflow: hidden;
}
.missing-answer-alter-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.missing-answer-alter:not(.is-open) .missing-answer-alter-head { border-bottom-color: transparent; }
.missing-answer-summary { display: flex; align-items: center; gap: 8px; min-width: 0; }
.missing-answer-alter-head > span { color: var(--faded); font-size: 13px; white-space: nowrap; }
.missing-answer-toggle {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; flex: 0 0 28px;
  padding: 0; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--faded); cursor: pointer;
}
.missing-answer-toggle:hover { color: var(--mist); background: color-mix(in srgb, var(--mist) 6%, transparent); }
.missing-answer-toggle span { display: block; font-size: 23px; line-height: 1; transition: transform .16s ease; }
.missing-answer-alter.is-open .missing-answer-toggle span { transform: rotate(90deg); }
.missing-answer-alter-name {
  border: none; background: none; padding: 0; color: var(--mist);
  font-size: 17px; font-weight: 700; text-align: left;
  overflow: hidden; text-overflow: ellipsis;
}
.missing-answer-alter-name:hover { color: var(--peach); border-color: transparent; }

/* Une fois l'alter déplié, sa photo reste bien visible à côté des questions. */
.missing-answer-questions {
  display: grid;
  grid-template-columns: minmax(190px, 240px) minmax(0, 1fr);
  align-items: start;
}
.missing-answer-questions[hidden] { display: none !important; }
.missing-answer-portrait {
  position: sticky;
  top: 18px;
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 16px;
  border-right: 1px solid var(--line);
}
.missing-answer-photo {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.missing-answer-photo-placeholder {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--faded);
  text-align: center;
}
.missing-answer-photo-placeholder span { font-size: 44px; line-height: 1; }
.missing-answer-photo-placeholder small { font-size: 12px; }
.missing-answer-open-sheet { width: 100%; max-width: 220px; font-size: 13px; }
.missing-answer-question-list { min-width: 0; }
.missing-answer-item {
  display: grid; grid-template-columns: 1fr; gap: 9px; align-items: start;
  padding: 12px 16px;
}
.missing-answer-item + .missing-answer-item { border-top: 1px solid var(--line); }
.missing-answer-question-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 3px 0; border: 0; background: transparent; color: inherit; text-align: left;
  cursor: pointer;
}
.missing-answer-question-toggle:hover { border-color: transparent; color: inherit; }
.missing-answer-copy { display: grid; gap: 4px; min-width: 0; }
.missing-answer-copy strong { font-size: 14px; }
.missing-answer-copy span { color: var(--faded); font-size: 13px; }
.missing-answer-reply-hint {
  display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto;
  color: var(--peach); font-size: 13px; font-weight: 700;
}
.missing-answer-reply-hint > span {
  color: inherit; font-size: 20px; line-height: 1; transition: transform .16s ease;
}
.missing-answer-item.is-editing .missing-answer-reply-hint > span { transform: rotate(90deg); }
.missing-answer-editor {
  display: grid; gap: 10px; padding: 12px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 56%, transparent);
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
}
.missing-answer-editor[hidden] { display: none !important; }
.missing-answer-editor-title { color: var(--faded); font-size: 13px; font-weight: 700; }
.missing-answer-options { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.missing-answer-choice { margin: 0; }
.missing-answer-editor-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.missing-answer-save { padding: 8px 14px; }
.missing-answer-inline-error { margin: 0; min-height: 0; }
.missing-answer-validate { justify-self: start; white-space: normal; font-size: 13px; }
.missing-answer-ok {
  display: flex; align-items: center; gap: 10px; margin-top: 16px;
  padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--sage) 45%, var(--line));
  border-radius: 12px; background: color-mix(in srgb, var(--sage) 6%, var(--night));
  color: var(--faded);
}
.missing-answer-ok strong { color: var(--mist); }
.missing-answer-error { margin: 10px 0 0; min-height: 0; }

/* Avertissement directement dans la fiche d'un alter. */
.alter-attr-field { margin-top: 10px; }
.alter-attr-label-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.alter-missing-warning {
  display: inline-flex; align-items: center; gap: 6px;
  color: #e7a45b; font-size: 12px; font-weight: 700;
}
.missing-ok-mini {
  min-width: 28px; height: 26px; padding: 1px 6px !important;
  border: 1px solid color-mix(in srgb, var(--sage) 55%, var(--line)) !important;
  border-radius: 8px !important; background: color-mix(in srgb, var(--sage) 7%, var(--night)) !important;
  color: var(--mist) !important; cursor: pointer; line-height: 1;
}
.missing-ok-mini:hover { border-color: var(--sage) !important; transform: translateY(-1px); }

@media (max-width: 720px) {
  .admin-missing-summary .section-head,
  .admin-missing-answers .section-head,
  .missing-answer-alter-head { flex-direction: column; align-items: stretch; }
  .missing-summary-warning { grid-template-columns: auto 1fr; }
  .missing-summary-go { grid-column: 1 / -1; width: 100%; }
  .missing-answer-actions { justify-content: flex-start; }
  .missing-answer-alter-head > span { padding-left: 36px; }
  .missing-answer-questions { grid-template-columns: 1fr; }
  .missing-answer-portrait {
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .missing-answer-photo { max-width: 260px; }
  .missing-answer-open-sheet { max-width: 260px; }
  .missing-answer-item { padding-left: 14px; }
  .missing-answer-question-toggle { align-items: flex-start; }
  .missing-answer-reply-hint { padding-top: 1px; }
}

/* ---------- Qualité des fiches / similarités ---------- */
.admin-similarity {
  background: color-mix(in srgb, var(--surface) 92%, var(--night));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
}
.admin-similarity .section-head { align-items: flex-start; }
.similarity-intro { margin-bottom: 0; }
.similarity-alert-grid { display: grid; gap: 10px; margin-top: 16px; }
.similarity-alert {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  text-align: left;
  padding: 15px 17px;
  border-radius: 14px;
  color: var(--mist);
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.similarity-alert:hover { transform: translateY(-1px); }
.similarity-alert-danger {
  border-color: color-mix(in srgb, var(--rose) 68%, var(--line));
  background: color-mix(in srgb, var(--rose) 10%, var(--surface));
}
.similarity-alert-danger:hover { border-color: var(--rose); }
.similarity-alert-warning {
  border-color: color-mix(in srgb, #e79a45 68%, var(--line));
  background: color-mix(in srgb, #e79a45 9%, var(--surface));
}
.similarity-alert-warning:hover { border-color: #e79a45; }
.similarity-alert-icon { font-size: 22px; }
.similarity-alert-copy { display: grid; gap: 3px; }
.similarity-alert-copy strong { font-size: 17px; }
.similarity-alert-copy > span { color: var(--faded); font-size: 14px; }
.similarity-alert-arrow { font-size: 28px; color: var(--faded); }
.similarity-ok {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--sage) 60%, var(--line));
  background: color-mix(in srgb, var(--sage) 9%, var(--surface));
  border-radius: 14px;
  color: var(--faded);
}
.similarity-ok strong { color: var(--mist); }
.similarity-error { margin: 10px 0 0; min-height: 0; }

.similarity-dialog { width: min(900px, 95vw) !important; }
.similarity-dialog-head { justify-content: space-between; align-items: flex-start; }
.similarity-dialog-head .section-sub { margin-bottom: 0; max-width: 680px; }
.similarity-close { flex-shrink: 0; }
.similarity-people {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 12px 0 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.similarity-person,
.similarity-name-link {
  border: 1px solid var(--line);
  background: var(--night);
  color: var(--mist);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 13px;
}
.similarity-person:hover,
.similarity-name-link:hover { border-color: var(--peach); color: var(--peach); }
.similarity-group {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--night) 60%, var(--surface));
  border-radius: 16px;
  padding: 17px;
  margin-bottom: 13px;
}
.similarity-group-danger { border-left: 4px solid var(--rose); }
.similarity-group-warning { border-left: 4px solid #e79a45; }
.similarity-group-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.similarity-group-head h3 { font-size: 18px; margin-bottom: 3px; }
.similarity-group-head p { color: var(--faded); font-size: 14px; }
.similarity-severity {
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  color: var(--faded);
}
.similarity-problem {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 70%, var(--night));
  font-size: 14px;
}
.similarity-difference {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 10px;
}
.similarity-difference > div {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  min-width: 0;
}
.similarity-vs { font-weight: 700; color: var(--faded); }
.similarity-values { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.similarity-value {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 8px;
  background: color-mix(in srgb, var(--peach) 13%, var(--night));
  border: 1px solid color-mix(in srgb, var(--peach) 28%, var(--line));
  font-size: 12px;
}
.similarity-missing { color: var(--faded); font-style: italic; font-size: 13px; }
.similarity-details { margin-top: 12px; }
.similarity-details summary { cursor: pointer; color: var(--peach); font-size: 14px; }
.similarity-common-list { display: grid; gap: 7px; margin-top: 10px; }
.similarity-common-row {
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(0, 1.2fr);
  gap: 10px;
  align-items: start;
  padding-top: 7px;
  border-top: 1px dashed var(--line);
}
.similarity-question-label { color: var(--faded); font-size: 13px; }
.similarity-common-row .similarity-values { margin-top: 0; }
.similarity-empty-profile { color: var(--faded); font-style: italic; font-size: 14px; margin-top: 10px; }
.similarity-differences-list { display: grid; gap: 10px; margin-top: 10px; }
.similarity-difference-card {
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255,255,255,.025);
}
.similarity-diff-title { display: block; margin-bottom: 8px; font-size: 14px; }
.similarity-actions {
  display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap;
  gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.08);
}
.similarity-actions > span { color: var(--faded); font-size: 12px; }
.similarity-validate { white-space: nowrap; }

@media (max-width: 650px) {
  .admin-similarity .section-head,
  .similarity-group-head { flex-direction: column; }
  .similarity-severity { white-space: normal; }
  .similarity-difference { grid-template-columns: 1fr; }
  .similarity-vs { text-align: center; }
  .similarity-common-row { grid-template-columns: 1fr; }
}

/* ---------- Sector : carte + emplacement visibles sans ascenseur latéral ---------- */
@media (min-width: 1700px) {
  body[data-system="sector"] .alter-side-stack-left {
    max-height: none;
    overflow: visible;
    scrollbar-width: none;
  }

  body[data-system="sector"] .alter-side-stack-left::-webkit-scrollbar {
    display: none;
  }

  /* La carte d'identité reste grande, mais sa hauteur est limitée pour laisser
     suffisamment de place à l'aperçu du secteur juste en dessous. */
  body[data-system="sector"] .alter-card-preview-wrap {
    min-height: 0;
    height: clamp(250px, 39vh, 325px);
  }

  body[data-system="sector"] .alter-card-preview-img {
    width: auto;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }

  /* Même principe pour la carte de localisation : elle se réduit avec la
     hauteur de l'écran au lieu de pousser la colonne dans un scroll. */
  body[data-system="sector"] .alter-location-preview-visual {
    aspect-ratio: auto;
    height: clamp(155px, 25vh, 215px);
    max-height: none;
  }

  body[data-system="sector"] .alter-location-preview-svg {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
  }
}

/* ---------- Fiche alter : localisation à gauche, récap + carte Sector à droite ---------- */
/* Ces règles finales remplacent l'ancien empilement Sector « carte + localisation » à gauche. */
.alter-side-stack-right {
  gap: 14px;
}

.alter-side-stack-right .alter-mapping-recap {
  position: static;
  inset: auto;
  width: 100%;
  max-height: none;
  margin: 0;
  overflow: visible;
}

/* La carte d'identité ne doit jamais être rognée : elle garde son ratio complet. */
.alter-side-stack-right .alter-card-preview-wrap {
  min-height: 220px;
  height: auto;
  overflow: hidden;
}
.alter-side-stack-right .alter-card-preview-img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: none;
  object-fit: contain;
}

@media (min-width: 1700px) {
  /* À gauche : uniquement la carte de localisation, fixe pendant le scroll de la fiche. */
  .alter-side-stack-left {
    position: absolute;
    right: calc(100% + 18px);
    left: auto;
    top: 0;
    width: clamp(320px, 20vw, 380px);
    max-height: none;
    overflow: visible;
    padding: 0;
    margin: 0;
    z-index: 6;
  }

  /* À droite : récap du mapping puis, pour Sector, la carte d'identité complète. */
  .alter-side-stack-right {
    position: absolute;
    left: calc(100% + 18px);
    right: auto;
    top: 0;
    width: clamp(285px, 16vw, 315px);
    max-height: none;
    overflow: visible;
    padding: 0;
    margin: 0;
    z-index: 6;
  }

  /* Sector : comme la carte d'identité n'est plus à gauche, la localisation peut respirer. */
  body[data-system="sector"] .alter-location-preview-visual {
    width: 100%;
    height: auto;
    max-height: none;
    aspect-ratio: 4 / 3;
  }
  body[data-system="sector"] .alter-location-preview-svg {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
  }

  /* Annule les anciennes limites de hauteur appliquées à la carte Sector à gauche. */
  body[data-system="sector"] .alter-side-stack-right .alter-card-preview-wrap {
    min-height: 220px;
    height: auto;
  }
  body[data-system="sector"] .alter-side-stack-right .alter-card-preview-img {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: none;
    object-fit: contain;
  }
}

@media (max-width: 1699px) {
  .alter-side-stack-right {
    position: static;
    width: auto;
    margin: 16px 28px 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .alter-side-stack-right .alter-mapping-recap {
    width: 100%;
    margin: 0;
  }
}

@media (max-width: 760px) {
  .alter-side-stack-right {
    margin: 14px 20px 0;
    grid-template-columns: 1fr;
  }
}

/* ---------- Correctif iPad / Safari : fiche alter responsive ---------- */
/*
   Les panneaux de localisation / mapping sont maintenant DANS .dialog-body.
   Sur desktop ils restent latéraux grâce au positionnement absolu existant.
   Sur tablette ils deviennent une rangée interne, ce qui évite à Safari de
   calculer une boîte <dialog> plus haute/large que le viewport et de créer
   le gros décalage + l'ascenseur horizontal vu sur iPad.
*/
.alter-dialog-responsive-panels {
  display: contents;
}

@media (max-width: 1699px) {
  #alterDialog.dialog-large {
    width: min(940px, calc(100vw - 28px));
    max-width: calc(100vw - 28px);
    margin-inline: auto;
  }

  #alterDialog .dialog-inner,
  #alterDialog .dialog-body {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Safari iPad : une seule zone scrolle, la popup elle-même ne déborde plus. */
  #alterDialog .dialog-body {
    max-height: min(78vh, 980px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .alter-dialog-responsive-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 14px;
    width: 100%;
    margin: 0 0 20px;
  }

  /* Annule les anciens placements/marges hors dialogue pour tablette. */
  .alter-side-stack-left,
  .alter-side-stack-right {
    position: static;
    inset: auto;
    width: 100%;
    min-width: 0;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: visible;
    grid-template-columns: 1fr;
  }

  .alter-side-stack-left > *,
  .alter-side-stack-right > *,
  .alter-mapping-recap,
  .alter-card-preview-panel,
  .alter-location-preview-panel {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .alter-side-stack-right .alter-mapping-recap,
  .alter-mapping-recap {
    position: static;
    inset: auto;
    width: 100%;
    max-height: none;
    margin: 0;
    overflow: visible;
  }

  /* Les aperçus restent contenus dans leur colonne, y compris sur Safari. */
  .alter-location-preview-visual,
  .alter-card-preview-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .alter-location-preview-svg,
  .alter-card-preview-img {
    display: block;
    max-width: 100%;
  }
}

/* iPad portrait et tablettes plus étroites : une seule colonne, sans débordement. */
@media (max-width: 900px) {
  #alterDialog.dialog-large {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
  }

  .alter-dialog-responsive-panels {
    grid-template-columns: 1fr;
  }

  /* Sur Sector on garde la carte entière, mais on évite qu'elle monopolise l'écran. */
  body[data-system="sector"] .alter-card-preview-img {
    width: auto;
    max-width: 100%;
    max-height: 430px;
    margin-inline: auto;
    object-fit: contain;
  }
}

/* Safari/iPad peut considérer des contenus flex/grid comme non réductibles si
   min-width:auto est conservé : on force le rétrécissement des champs. */
@media (max-width: 1699px) {
  #alterDialog .form-grid,
  #alterDialog #alterAttrs,
  #alterDialog .alter-dialog-identity,
  #alterDialog .dialog-head {
    min-width: 0;
    max-width: 100%;
  }

  #alterDialog input,
  #alterDialog textarea,
  #alterDialog select {
    max-width: 100%;
    box-sizing: border-box;
  }
}


/* ---------- Inclusion d'un alter dans le quiz + mapping ---------- */
.alter-include-toggle {
  margin-top: 9px;
  min-height: 34px;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid var(--line);
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.alter-include-toggle.is-included {
  color: var(--sage);
  border-color: color-mix(in srgb, var(--sage) 48%, var(--line));
  background: color-mix(in srgb, var(--sage) 10%, var(--surface));
}

.alter-include-toggle.is-excluded {
  color: var(--peach);
  border-color: color-mix(in srgb, var(--peach) 50%, var(--line));
  background: color-mix(in srgb, var(--peach) 9%, var(--surface));
}

.admin-inclusion-state {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.admin-inclusion-state.is-excluded {
  color: var(--peach);
  border: 1px solid color-mix(in srgb, var(--peach) 42%, var(--line));
  background: color-mix(in srgb, var(--peach) 8%, transparent);
}

.admin-double-profile-state {
  display: block;
  width: max-content;
  max-width: 100%;
  margin-top: 4px;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--rose) 42%, var(--line));
  border-radius: 999px;
  color: var(--rose);
  background: color-mix(in srgb, var(--rose) 8%, transparent);
  font-size: 11px;
  font-weight: 800;
}

.alter-mapping-recap-excluded {
  padding: 10px 0 3px;
  color: var(--peach);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 700;
}

/* ---------- Identité structurée des alters ---------- */
.alter-name-lines {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
  line-height: 1.08;
  vertical-align: middle;
}
.alter-name-first,
.alter-name-last {
  display: block;
  max-width: 100%;
}
.alter-name-nickname {
  font-size: .72em;
  font-weight: inherit;
  opacity: .72;
  white-space: nowrap;
}
.alter-name-relation { display: inline; }

.alter-identity-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 4px;
}
.alter-identity-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.alter-identity-field > span { font-weight: 700; }
.alter-identity-field small {
  color: var(--faded);
  font-weight: 400;
  font-size: .78em;
}
.alter-identity-help {
  margin: 0 0 10px;
  color: var(--faded);
  font-size: 12px;
  line-height: 1.35;
}
.admin-awareness-date {
  display: block;
  width: max-content;
  margin-top: 4px;
  color: var(--sage);
  font-size: 11px;
  font-weight: 600;
}
@media (max-width: 720px) {
  .alter-identity-fields { grid-template-columns: 1fr; }
}


/* ---------- PAWS 3.1.11 : onglet Autre gestion + splits ---------- */
.alter-editor-tabs {
  display: flex;
  gap: 8px;
  margin: 4px 0 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--night) 72%, transparent);
}
.alter-editor-tab {
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  color: var(--faded);
  font-weight: 800;
}
.alter-editor-tab.is-active {
  color: var(--text);
  border-color: color-mix(in srgb, var(--rose) 52%, var(--line));
  background: color-mix(in srgb, var(--rose) 15%, var(--surface));
}
.alter-editor-panel[hidden] { display: none !important; }
.alter-other-management { display: grid; gap: 14px; }
.alter-management-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--night) 78%, var(--surface));
}
.alter-management-card h3 { margin: 0 0 4px; }
.alter-management-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.alter-management-card-head p {
  margin: 0;
  color: var(--faded);
  font-size: 13px;
  line-height: 1.4;
}
.alter-management-mapping { display: grid; gap: 8px; }
.alter-management-check {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  cursor: pointer;
}
.alter-management-check.is-automatic { opacity: .82; cursor: default; }
.alter-management-check input { width: 18px; height: 18px; accent-color: var(--rose); }
.alter-management-check-copy { display: grid; gap: 1px; }
.alter-management-check-copy small { color: var(--faded); }
.alter-management-empty,
.alter-split-origin-note {
  margin: 0;
  color: var(--faded);
  font-size: 13px;
  line-height: 1.4;
}
.alter-double-profile-note {
  margin: 0;
  color: var(--faded);
  font-size: 13px;
  line-height: 1.4;
}
.alter-double-profile-save-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}
.alter-double-profile-save-row .alter-double-profile-note { flex: 1 1 auto; }
.alter-double-profile-save-row #alterSaveDoubleProfile { flex: 0 0 auto; white-space: nowrap; }
.alter-double-profile-save-row #alterSaveDoubleProfile.is-dirty {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--rose) 28%, transparent);
}
.alter-split-origin-note { margin: 0; }
.alter-split-save-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}
.alter-split-save-row .alter-split-origin-note { flex: 1 1 auto; }
.alter-split-save-row #alterSaveSplit { flex: 0 0 auto; white-space: nowrap; }
.alter-split-save-row #alterSaveSplit.is-dirty {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--rose) 28%, transparent);
}
.alter-split-children { display: grid; gap: 7px; margin-top: 12px; }
.alter-split-child-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--faded);
}
.alter-split-child-row strong { color: var(--text); text-align: right; }
.alter-attr-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.alter-question-skip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--faded);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease;
}
.alter-question-skip input {
  width: 14px;
  height: 14px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--rose);
}
.alter-question-skip.is-skipped {
  color: var(--rose);
  border-color: color-mix(in srgb, var(--rose) 48%, var(--line));
  background: color-mix(in srgb, var(--rose) 10%, var(--surface));
}
.alter-split-preview-panel {
  width: 100%;
  padding: 14px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--night) 82%, var(--surface));
  box-shadow: 0 12px 36px rgba(0, 0, 0, .34);
}
.alter-split-preview-panel[hidden] { display: none !important; }
.alter-split-preview-list,
.sheet-split-list { display: grid; gap: 10px; }
.split-pair-card { display: grid; gap: 7px; }
.split-composite {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 13px;
  background: var(--night);
}
.split-photo {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  object-fit: cover;
}
.split-photo-left { left: 0; }
.split-photo-right { right: 0; }
.split-photo-placeholder {
  display: grid;
  place-items: center;
  font-size: 42px;
  background: color-mix(in srgb, var(--surface) 76%, var(--night));
}
.split-separator {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 0;
  width: 5px;
  height: 100%;
  background: #050505;
  transform: translateX(-50%);
  box-shadow: 0 0 0 1px rgba(255,255,255,.08);
}
.split-pair-caption {
  color: var(--mist);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}
.sheet-split {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.sheet-double-profile {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.sheet-double-profile[hidden] { display: none !important; }
.double-profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px;
  border: 1px solid color-mix(in srgb, var(--rose) 42%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--rose) 8%, var(--surface));
}
.double-profile-card > img,
.double-profile-card > .placeholder {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border-radius: 50%;
  object-fit: cover;
}
.double-profile-card > .placeholder { display: grid; place-items: center; background: var(--night); }
.double-profile-card > div { display: grid; gap: 2px; min-width: 0; }
.double-profile-card strong { color: var(--mist); font-size: 17px; }
.double-profile-card small { color: var(--faded); line-height: 1.35; }
.double-profile-kicker {
  color: var(--rose);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.sheet-split[hidden] { display: none !important; }
.sheet-split-title {
  margin-bottom: 10px;
  color: var(--faded);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.sheet-split .split-pair-card {
  grid-template-columns: minmax(160px, 260px) 1fr;
  align-items: center;
}
.sheet-split .split-pair-caption { text-align: left; }

@media (max-width: 760px) {
  .alter-management-card-head { display: grid; }
  .alter-management-card-head .primary { width: 100%; }
  .alter-split-save-row { align-items: stretch; flex-direction: column; }
  .alter-double-profile-save-row { align-items: stretch; flex-direction: column; }
  .alter-split-save-row #alterSaveSplit { width: 100%; }
  .alter-double-profile-save-row #alterSaveDoubleProfile { width: 100%; }
  .alter-split-child-row { display: grid; }
  .alter-split-child-row strong { text-align: left; }
  .sheet-split .split-pair-card { grid-template-columns: 1fr; }
  .sheet-split .split-pair-caption { text-align: center; }
}

/* ===== PAWS 3.1.13 — lecture claire des chaînes de split ===== */
.alter-split-preview-list,
.sheet-split-list {
  gap: 12px;
}
.alter-split-preview-group {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.alter-split-preview-group + .alter-split-preview-group {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.alter-split-preview-group-title,
.alter-split-children-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--faded);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .045em;
  text-transform: uppercase;
}
.alter-split-preview-group-title span {
  display: inline-grid;
  min-width: 23px;
  height: 23px;
  place-items: center;
  padding-inline: 6px;
  border-radius: 999px;
  color: var(--mist);
  background: color-mix(in srgb, var(--rose) 14%, var(--surface));
}
.alter-split-preview-scroll {
  display: grid;
  gap: 10px;
  max-height: 330px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scrollbar-width: thin;
}
.split-side-label {
  position: absolute;
  z-index: 4;
  top: 7px;
  max-width: calc(50% - 18px);
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(5, 5, 5, .78);
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.28);
}
.split-side-label-left { left: 7px; }
.split-side-label-right { right: 7px; }
.alter-split-children {
  min-width: 0;
}
.alter-split-children-title {
  margin-bottom: 8px;
}
.alter-split-children-scroll {
  display: grid;
  gap: 7px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

@media (max-width: 760px) {
  .alter-split-preview-scroll { max-height: 280px; }
  .alter-split-children-scroll { max-height: 200px; }
}

/* ===== PAWS 3.1.14 — lecture des splits sans titre générique ===== */
/*
   Convention visuelle unique :
   - l'ORIGINE est toujours à gauche ;
   - le SPLIT est toujours à droite ;
   - la relation affichée est uniquement « Origine de … » ou « Split de … ».
   Cela reste vrai même lorsqu'un alter est à la fois split de quelqu'un et
   origine d'autres splits.
*/
.alter-split-preview-panel {
  min-width: 0;
  overflow: hidden;
}

.alter-split-preview-list,
.sheet-split-list {
  min-width: 0;
}

.split-pair-card {
  min-width: 0;
  gap: 7px;
}

.split-relation-title {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  color: var(--faded);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .035em;
  text-transform: uppercase;
  line-height: 1.25;
}
.split-relation-title span {
  flex: 0 0 auto;
}
.split-relation-title strong {
  min-width: 0;
  color: var(--mist);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
  overflow-wrap: anywhere;
}

/* Deux moitiés réellement lisibles : une origine à gauche, un split à droite. */
.split-composite {
  aspect-ratio: 2 / 1;
  min-width: 0;
}
.split-separator {
  width: 4px;
}

/* Les groupes restent indépendamment scrollables si une chaîne devient longue. */
.alter-split-preview-scroll {
  min-width: 0;
  max-height: min(310px, 36vh);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.alter-split-preview-group[data-split-group="split-of"] .alter-split-preview-scroll {
  /* Un alter n'a qu'une seule origine, mais on garde le même comportement
     scrollable sur les écrans très bas. */
  max-height: min(245px, 30vh);
}
.alter-split-preview-group[data-split-group="origin-of"] .alter-split-preview-scroll {
  max-height: min(330px, 38vh);
}

/* Si la fiche est à la fois Split de ET Origine de, les deux blocs se partagent
   la hauteur disponible au lieu de faire sortir la colonne du viewport. */
.alter-split-preview-list:has(.alter-split-preview-group[data-split-group="split-of"]):has(.alter-split-preview-group[data-split-group="origin-of"])
  :is(.alter-split-preview-group[data-split-group="split-of"], .alter-split-preview-group[data-split-group="origin-of"])
  .alter-split-preview-scroll {
  max-height: min(250px, 27vh);
}

/* Dans la fiche de résultat du quiz, la relation reste verticale et compacte :
   le titre de relation est au-dessus des deux portraits. */
.sheet-split .split-pair-card {
  grid-template-columns: 1fr;
  align-items: stretch;
}
.sheet-split .split-relation-title {
  text-align: left;
}

/* Tablettes / petits PC : aucun panneau de split ne peut imposer une largeur
   supérieure à sa colonne. */
@media (max-width: 1699px) {
  #alterDialog .alter-split-preview-panel,
  #alterDialog .alter-split-preview-list,
  #alterDialog .alter-split-preview-group,
  #alterDialog .split-pair-card,
  #alterDialog .split-composite {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .alter-split-preview-scroll {
    max-height: min(300px, 34vh);
  }
}

/* iPad portrait / écrans étroits : le panneau reste compact dans la pile unique. */
@media (max-width: 900px) {
  .alter-split-preview-scroll,
  .alter-split-preview-group[data-split-group="origin-of"] .alter-split-preview-scroll,
  .alter-split-preview-group[data-split-group="split-of"] .alter-split-preview-scroll {
    max-height: min(260px, 32vh);
  }

  .split-relation-title {
    flex-wrap: wrap;
    row-gap: 2px;
  }
}

/* iPhone et très petites résolutions : on conserve impérativement les deux
   portraits côte à côte, tout en réduisant les marges et badges. */
@media (max-width: 520px) {
  .alter-split-preview-panel {
    padding: 10px;
    border-radius: 13px;
  }

  .alter-split-preview-list,
  .sheet-split-list {
    gap: 9px;
  }

  .alter-split-preview-group + .alter-split-preview-group {
    padding-top: 8px;
  }

  .alter-split-preview-scroll,
  .alter-split-preview-group[data-split-group="origin-of"] .alter-split-preview-scroll,
  .alter-split-preview-group[data-split-group="split-of"] .alter-split-preview-scroll {
    max-height: min(225px, 31vh);
    padding-right: 2px;
  }

  .split-composite {
    aspect-ratio: 2 / 1;
    border-radius: 10px;
  }

  .split-separator {
    width: 3px;
  }

  .split-side-label {
    top: 5px;
    padding: 2px 5px;
    font-size: 8px;
  }
  .split-side-label-left { left: 5px; }
  .split-side-label-right { right: 5px; }

  .split-relation-title {
    font-size: 10px;
  }
  .split-relation-title strong {
    font-size: 11px;
  }
}

/* Très petit écran en hauteur (petit PC / téléphone paysage). */
@media (max-height: 720px) {
  .alter-split-preview-scroll,
  .alter-split-preview-group[data-split-group="origin-of"] .alter-split-preview-scroll,
  .alter-split-preview-group[data-split-group="split-of"] .alter-split-preview-scroll {
    max-height: 190px;
  }
}


/* ===== PAWS 3.1.15 — position physique Origine / Split ===== */
/*
   Le contenu des portraits était déjà correctement orienté en 3.1.14, mais
   l’encart complet vivait encore uniquement dans la pile de gauche.
   Désormais les deux directions possèdent leur propre panneau :
   - origine de X -> pile gauche ;
   - split de X   -> pile droite.
   Un alter qui est à la fois origine ET split peut donc afficher les deux côtés.
*/
#alterSplitOriginPreviewPanel,
#alterSplitOfPreviewPanel {
  width: 100%;
  min-width: 0;
}

/* Sur grand écran, aucune translation artificielle : c’est la pile parente
   gauche/droite qui décide réellement du côté de l’encart. */
@media (min-width: 1700px) {
  #alterSplitOriginPreviewPanel,
  #alterSplitOfPreviewPanel {
    position: static;
    inset: auto;
  }
}

/* Tablette / petit PC : les deux colonnes restent distinctes tant que la place
   le permet. Le panneau Split reste donc dans la colonne de droite. */
@media (min-width: 761px) and (max-width: 1699px) {
  #alterSplitOriginPreviewPanel,
  #alterSplitOfPreviewPanel {
    max-width: 100%;
  }
}

/* iPhone / écrans étroits : les piles passent naturellement l’une sous l’autre.
   On conserve l’ordre logique gauche puis droite sans provoquer de débordement. */
@media (max-width: 760px) {
  #alterDialog .alter-dialog-responsive-panels {
    grid-template-columns: 1fr;
  }
  #alterDialog #alterLeftStack,
  #alterDialog #alterRightStack {
    width: 100%;
    min-width: 0;
  }
}

/* ---------- Journal des mises à jour (Admin uniquement, 3.1.18) ---------- */
.admin-update-open {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.admin-update-open.has-unread {
  border-color: var(--rose);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rose) 24%, transparent);
}
.admin-update-badge {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--rose);
  color: var(--night);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}
.admin-update-badge[hidden] { display: none; }

.admin-update-dialog {
  width: min(860px, calc(100vw - 28px));
  max-width: 860px;
  max-height: min(86vh, 820px);
  max-height: min(86dvh, 820px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  color: var(--mist);
  box-shadow: 0 30px 90px rgba(0,0,0,.5);
}
.admin-update-dialog::backdrop {
  background: rgba(5,3,15,.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.admin-update-shell {
  display: flex;
  min-height: 0;
  max-height: inherit;
  flex-direction: column;
}
.admin-update-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 23px 25px 17px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface) 94%, var(--rose)), var(--surface));
}
.admin-update-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--rose);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.admin-update-head h2 { margin: 0; color: var(--mist); font-size: clamp(25px, 4vw, 34px); }
.admin-update-head p { margin: 7px 0 0; color: var(--faded); font-size: 14px; }
.admin-update-close {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--night);
  color: var(--mist);
  cursor: pointer;
}
.admin-update-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--night) 30%, var(--surface));
}
.admin-update-tab {
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--faded);
  font-weight: 800;
  cursor: pointer;
}
.admin-update-tab.is-active {
  border-color: color-mix(in srgb, var(--rose) 40%, var(--line));
  background: color-mix(in srgb, var(--rose) 12%, var(--surface));
  color: var(--mist);
}
.admin-update-body {
  min-height: 250px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 19px 21px 25px;
  -webkit-overflow-scrolling: touch;
}
.admin-update-loading,
.admin-update-empty {
  display: grid;
  min-height: 230px;
  place-items: center;
  align-content: center;
  gap: 9px;
  padding: 25px;
  text-align: center;
  color: var(--faded);
}
.admin-update-empty h3 { margin: 0; color: var(--mist); font-size: 22px; }
.admin-update-empty p { margin: 0; }
.admin-update-empty-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid rgba(112,227,177,.55);
  border-radius: 50%;
  color: #70e3b1;
  font-size: 24px;
  font-weight: 900;
}
.admin-update-new-intro {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 13px;
  padding: 13px 14px;
  border: 1px solid color-mix(in srgb, var(--rose) 30%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--rose) 8%, var(--surface));
}
.admin-update-new-intro > span { font-size: 21px; }
.admin-update-new-intro strong { color: var(--mist); }
.admin-update-new-intro p { margin: 3px 0 0; color: var(--faded); font-size: 13px; }
.admin-update-card {
  margin-top: 12px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 92%, var(--night));
}
.admin-update-card.is-new { border-color: color-mix(in srgb, var(--rose) 38%, var(--line)); }
.admin-update-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-update-version {
  display: inline-flex;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rose) 13%, var(--surface));
  color: var(--rose);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}
.admin-update-new-pill,
.admin-update-history-unread {
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--rose);
  color: var(--night);
  font-size: 10px;
  font-weight: 900;
}
.admin-update-card h3 { margin: 9px 0 10px; color: var(--mist); font-size: 18px; }
.admin-update-card ul,
.admin-update-history-content ul { margin: 0; padding-left: 20px; }
.admin-update-card li,
.admin-update-history-content li { margin: 8px 0; line-height: 1.5; }
.admin-update-card li::marker,
.admin-update-history-content li.is-unread::marker { color: var(--rose); }
.admin-update-history { display: grid; gap: 9px; }
.admin-update-history-entry {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 92%, var(--night));
}
.admin-update-history-entry summary {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  cursor: pointer;
  list-style: none;
}
.admin-update-history-entry summary::-webkit-details-marker { display: none; }
.admin-update-history-entry summary strong {
  min-width: 0;
  overflow: hidden;
  color: var(--mist);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-update-chevron { color: var(--faded); transition: transform .16s ease; }
.admin-update-history-entry[open] .admin-update-chevron { transform: rotate(180deg); }
.admin-update-history-content {
  padding: 4px 16px 15px;
  border-top: 1px solid var(--line);
}
.admin-update-history-content li.is-unread { color: var(--mist); font-weight: 700; }
.admin-update-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 17px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 97%, var(--night));
}
.admin-update-foot p { margin: 0; color: var(--faded); font-size: 11px; }
.admin-update-actions { display: flex; gap: 8px; }
.admin-update-actions button { width: auto; margin: 0; white-space: nowrap; }

@media (max-width: 700px) {
  .admin-update-dialog {
    width: calc(100vw - 12px);
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 17px;
  }
  .admin-update-head { padding: 17px 16px 13px; }
  .admin-update-head p { font-size: 12px; }
  .admin-update-tabs { padding: 8px; }
  .admin-update-tab { padding: 9px 7px; font-size: 12px; }
  .admin-update-body { padding: 14px 12px 18px; }
  .admin-update-card { padding: 14px; }
  .admin-update-history-entry summary { grid-template-columns: auto minmax(0,1fr) auto; gap: 7px; }
  .admin-update-history-entry summary strong { white-space: normal; }
  .admin-update-history-unread { grid-column: 2; width: fit-content; }
  .admin-update-chevron { grid-column: 3; grid-row: 1 / span 2; }
  .admin-update-foot { align-items: stretch; flex-direction: column; gap: 9px; }
  .admin-update-foot p { text-align: center; }
  .admin-update-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .admin-update-actions button { width: 100%; white-space: normal; }
}

@media (max-width: 420px) {
  .admin-update-tabs { grid-template-columns: 1fr; }
  .admin-update-history-entry summary { grid-template-columns: 1fr auto; }
  .admin-update-history-entry summary .admin-update-version,
  .admin-update-history-entry summary strong,
  .admin-update-history-unread { grid-column: 1; }
  .admin-update-chevron { grid-column: 2; grid-row: 1 / span 3; }
  .admin-update-actions { grid-template-columns: 1fr; }
}

/* ---------- Paws 4.0 : notifications de messagerie ---------- */
.messaging-nav-link { position: relative; }
.messaging-nav-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--rose);
  color: #241a27;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  vertical-align: 1px;
}
.messaging-nav-badge[hidden] { display: none !important; }

.paws-message-toast-stack {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 10040;
  display: grid;
  gap: 10px;
  width: min(390px, calc(100vw - 28px));
  pointer-events: none;
}
.paws-message-toast {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0,1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 13px 13px 13px 12px;
  border: 1px solid color-mix(in srgb, var(--peach) 42%, var(--line));
  border-radius: 17px;
  background: color-mix(in srgb, var(--surface) 97%, var(--night));
  box-shadow: 0 22px 60px rgba(0,0,0,.38);
  pointer-events: auto;
  animation: paws-message-toast-in .24s ease-out both;
}
.paws-message-toast-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--peach) 13%, var(--night));
  font-size: 22px;
}
.paws-message-toast-copy { min-width: 0; }
.paws-message-toast-title { color: var(--peach); font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.paws-message-toast-text { margin-top: 2px; color: var(--mist); font-size: 13px; line-height: 1.35; }
.paws-message-toast-preview {
  margin-top: 4px;
  overflow: hidden;
  color: var(--faded);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.paws-message-toast-open {
  width: auto;
  padding: 8px 10px;
  border-color: color-mix(in srgb, var(--peach) 42%, var(--line));
  font-size: 12px;
}
.paws-message-toast-close {
  position: absolute;
  top: 4px;
  right: 5px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--faded);
  font-size: 15px;
  line-height: 1;
}
@keyframes paws-message-toast-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 520px) {
  .paws-message-toast-stack { left: 10px; bottom: 10px; width: calc(100vw - 20px); }
  .paws-message-toast { grid-template-columns: 38px minmax(0,1fr); padding-right: 11px; }
  .paws-message-toast-icon { width: 38px; height: 38px; }
  .paws-message-toast-open { grid-column: 2; justify-self: start; margin-top: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  .paws-message-toast { animation: none; }
}

/* ========================================================================== */
/* PAWS 4.1.1 — position de la bulle de messagerie                            */
/* ========================================================================== */
.paws-floating-messaging {
  position: relative;
  z-index: 12000;
}

.paws-floating-messaging-bubble {
  position: fixed;
  left: max(18px, env(safe-area-inset-left));
  bottom: max(54px, calc(env(safe-area-inset-bottom) + 44px));
  z-index: 12020;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--peach) 58%, var(--line));
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, color-mix(in srgb, var(--peach) 22%, transparent), transparent 42%),
    color-mix(in srgb, var(--surface) 96%, var(--night));
  color: var(--ink);
  box-shadow: 0 14px 38px rgba(0,0,0,.34);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.paws-floating-messaging-bubble:hover,
.paws-floating-messaging-bubble:focus-visible {
  transform: translateY(-2px) scale(1.03);
  border-color: var(--peach);
  box-shadow: 0 18px 46px rgba(0,0,0,.42);
}
.paws-floating-messaging-bubble.has-unread {
  animation: pawsMessagingBubbleNudge 2.4s ease-in-out infinite;
}
.paws-floating-messaging-icon {
  font-size: 27px;
  line-height: 1;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,.2));
}
.paws-floating-messaging-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  border: 2px solid var(--night);
  border-radius: 999px;
  background: #ff4757;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 5px 16px rgba(255,71,87,.42);
}
.paws-floating-messaging-badge[hidden] { display: none !important; }

.paws-floating-messaging-overlay {
  position: fixed;
  inset: 0;
  z-index: 12010;
  display: grid;
  place-items: center;
  padding: 26px;
}
.paws-floating-messaging-overlay[hidden] { display: none !important; }
.paws-floating-messaging-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 3, 13, .48);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.paws-floating-messaging-panel {
  position: relative;
  z-index: 1;
  width: min(1500px, calc(100vw - 52px));
  height: min(920px, calc(100dvh - 52px));
  min-height: 420px;
  overflow: visible;
  border: 1px solid color-mix(in srgb, var(--peach) 30%, var(--line));
  border-radius: 24px;
  background: var(--night);
  box-shadow: 0 32px 100px rgba(0,0,0,.56);
  animation: pawsMessagingPanelIn .18s ease-out both;
}
.paws-floating-messaging-frame {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  border-radius: inherit;
  background: var(--night);
}
.paws-floating-messaging-close {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 5;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0 0 2px;
  border: 1px solid color-mix(in srgb, var(--peach) 38%, var(--line));
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 93%, var(--night));
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(0,0,0,.32);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}
.paws-floating-messaging-close:hover,
.paws-floating-messaging-close:focus-visible {
  border-color: var(--peach);
  color: var(--peach);
}
body.paws-messaging-widget-open {
  overflow: hidden !important;
}
body.paws-messaging-widget-open .paws-floating-messaging-bubble {
  opacity: 0;
  pointer-events: none;
  transform: scale(.86);
}

/* Les toasts restent visibles au-dessus de la bulle quand elle est fermée. */
#pawsFloatingMessaging ~ .paws-message-toast-stack {
  bottom: max(128px, calc(env(safe-area-inset-bottom) + 118px));
}

@keyframes pawsMessagingPanelIn {
  from { opacity: 0; transform: translateY(10px) scale(.992); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pawsMessagingBubbleNudge {
  0%, 82%, 100% { transform: translateY(0) rotate(0); }
  87% { transform: translateY(-2px) rotate(-4deg); }
  91% { transform: translateY(0) rotate(4deg); }
  95% { transform: translateY(-1px) rotate(-2deg); }
}

@media (max-width: 850px) {
  .paws-floating-messaging-overlay {
    padding:
      max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
  }
  .paws-floating-messaging-panel {
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 18px;
  }
  .paws-floating-messaging-close {
    top: -5px;
    right: -5px;
    width: 36px;
    height: 36px;
    font-size: 23px;
  }
  .paws-floating-messaging-bubble {
    left: max(12px, env(safe-area-inset-left));
    bottom: max(50px, calc(env(safe-area-inset-bottom) + 42px));
    width: 54px;
    height: 54px;
  }
  .paws-floating-messaging-icon { font-size: 25px; }
}

@media (prefers-reduced-motion: reduce) {
  .paws-floating-messaging-panel,
  .paws-floating-messaging-bubble.has-unread { animation: none; }
  .paws-floating-messaging-bubble { transition: none; }
}

/* ---------- Paws 5.3.2 : chargement léger de la liste des alters ---------- */
#alterList {
  position: relative;
  min-height: 64px;
}
#alterList.is-loading {
  min-height: 84px;
}
#alterList.is-loading::after {
  content: "Chargement des alters…";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  min-height: 64px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  color: var(--faded);
  font-size: 14px;
  font-weight: 700;
  backdrop-filter: blur(2px);
  z-index: 2;
}
#alterList.is-loading > * {
  opacity: .42;
}
