:root {
  --bg: #f4efe6;
  --fg: #2b2a27;
  --accent: #8c5a2b;
  --accent-dark: #6a4420;
  --muted: #6d6a63;
  --panel-bg: #fbf7ef;
  --border: #d9cfbd;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  --banner-bg: #fff3dc;
  --banner-fg: #6a4420;
  --topbar-h: 84px;
}

* { box-sizing: border-box; }

/* L'attribut `hidden` doit l'emporter sur display:flex/grid, sinon les
   éléments masqués réapparaissent (MediaRecorder live/preview/error…). */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  color: var(--fg);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  padding: 0.75rem 1.2rem;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.topbar-titles h1 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.tagline {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-style: italic;
  font-size: 0.95rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.banner {
  background: var(--banner-bg);
  color: var(--banner-fg);
  border-bottom: 1px solid var(--border);
  padding: 0.45rem 0.5rem 0.45rem 1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.banner-text {
  flex: 1;
  text-align: center;
}
.banner code {
  background: rgba(0,0,0,0.06);
  padding: 0 0.25rem;
  border-radius: 3px;
  font-size: 0.88em;
}
.banner-close {
  background: transparent;
  border: none;
  color: var(--banner-fg);
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.1rem 0.5rem;
  cursor: pointer;
  min-width: 32px;
  min-height: 32px;
  border-radius: 3px;
}
.banner-close:hover {
  background: rgba(0, 0, 0, 0.06);
}

.btn-primary, .btn-ghost {
  font: inherit;
  cursor: pointer;
  padding: 0.55rem 1rem;
  border-radius: 4px;
  border: 1px solid var(--accent);
  min-height: 44px;
  touch-action: manipulation;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); }

.btn-primary.btn-locked {
  background: #aa9a82;
  border-color: #aa9a82;
  cursor: help;
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
}
.btn-ghost:hover { background: rgba(140, 90, 43, 0.08); }

.hint {
  font-style: italic;
  color: var(--accent-dark);
  font-size: 0.9rem;
}

main {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
}

/* ── Panneau latéral (desktop) ─────────────────────────────── */
.panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(420px, 100%);
  background: var(--panel-bg);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
  padding: 1rem 1.2rem 4rem;
  z-index: 500;
  -webkit-overflow-scrolling: touch;
}

.panel[aria-hidden="false"] {
  transform: translateX(0);
}

.panel-close {
  position: absolute;
  top: 0.4rem;
  right: 0.6rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--muted);
  min-height: 40px;
}
.panel-close span[aria-hidden] {
  font-size: 1.8rem;
  line-height: 0.7;
}
.panel-close-label {
  font-size: 0.9rem;
}
.panel-close:hover {
  color: var(--fg);
  background: rgba(0, 0, 0, 0.05);
  border-color: var(--border);
}

.panel h2 {
  margin: 0.4rem 0 0.2rem;
  font-size: 1.4rem;
  padding-right: 2.5rem;
}

.panel .desc {
  margin: 0 0 1rem;
  color: var(--muted);
}

.panel .add-story,
.entity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 1.2rem;
}

.story {
  border-top: 1px solid var(--border);
  padding: 0.9rem 0;
}

.story h3 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

.story .meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.story .body {
  white-space: pre-wrap;
  line-height: 1.55;
}

.story img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin-top: 0.4rem;
}

.story audio {
  width: 100%;
  margin-top: 0.4rem;
}

.story .type-badge {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--accent);
  color: #fff;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  margin-right: 0.4rem;
  vertical-align: middle;
}

.story .story-title {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
}
.story .story-title:hover {
  border-bottom-color: var(--accent);
}

.story-byline {
  margin: 0.3rem 0 0.3rem;
  padding: 0.35rem 0.6rem;
  background: rgba(140, 90, 43, 0.06);
  border-left: 3px solid var(--accent);
  border-radius: 0 3px 3px 0;
  font-size: 0.95rem;
  font-style: italic;
}
.story-byline small {
  color: var(--muted);
  font-style: normal;
}

.places-told {
  margin: 0.3rem 0 0.8rem;
  line-height: 1.8;
}

/* ── Complétions attribuées ─────────────────────────────────── */
.completion {
  margin: 0.7rem 0 0.3rem;
  padding: 0.6rem 0.8rem;
  background: rgba(122, 58, 106, 0.05);
  border-left: 3px solid #7a3a6a;
  border-radius: 0 4px 4px 0;
}
.completion-head {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.completion-head strong { color: var(--fg); }
.completion-head .rel {
  font-style: italic;
}
.completion-date { color: var(--muted); }
.completion-body {
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 0.95rem;
}

/* Actions de récit — placées juste après l'entête pour rester visibles
   sans scroller, y compris dans le bottom-sheet mobile. */
.story-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0 0.6rem;
}
.story-actions button {
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
  min-height: 34px;
}

/* ── Fieldset "contributor-id" ──────────────────────────────── */
fieldset.contributor-id {
  margin: 0.9rem 0 0.3rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.015);
}
fieldset.contributor-id legend {
  padding: 0 0.4rem;
  font-weight: 600;
  color: var(--accent-dark);
  font-size: 0.9rem;
}
fieldset.contributor-id legend small {
  font-weight: normal;
  color: var(--muted);
  font-style: italic;
}
fieldset.contributor-id label {
  margin: 0.4rem 0;
  font-size: 0.9rem;
}
fieldset.contributor-id label em {
  font-weight: normal;
  color: var(--muted);
  font-style: italic;
  font-size: 0.85rem;
}

/* ── Autocompletion des noms ───────────────────────────────── */
.autocomplete-menu {
  position: absolute;
  z-index: 3000;
  list-style: none;
  margin: 0;
  padding: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: var(--shadow);
  max-height: 220px;
  overflow-y: auto;
  font-size: 0.9rem;
}
.autocomplete-menu li {
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.autocomplete-menu li:last-child { border-bottom: none; }
.autocomplete-menu li:hover { background: rgba(140,90,43,0.1); }
.autocomplete-menu .ac-alias {
  color: var(--muted);
  font-style: italic;
  font-size: 0.85rem;
}

/* ── Nouvelle fiche (création à la volée) ──────────────────── */
details.new-person {
  margin: 0.4rem 0 0.8rem;
  padding: 0.4rem 0.7rem;
  background: rgba(122, 58, 106, 0.04);
  border: 1px solid var(--border);
  border-radius: 5px;
}
details.new-person > summary {
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--accent-dark);
  padding: 0.2rem 0;
  user-select: none;
}
details.new-person[open] > summary {
  margin-bottom: 0.4rem;
}
details.new-person .new-person-hint {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
  margin: 0.25rem 0 0.4rem;
}

/* Boutons inline sur le header d'une complétion */
.completion-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.completion-byline { flex: 1; }
.btn-inline {
  padding: 0.15rem 0.4rem;
  min-height: 28px;
  font-size: 0.85rem;
}

/* ── Entête d'entité (lieu / personne / récit) ─────────────── */
.entity-header {
  margin: 0 0 0.6rem;
}
.entity-kind {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.entity-header h2 {
  margin: 0.2rem 0 0.3rem;
}
.entity-header small {
  color: var(--muted);
  font-weight: normal;
}
.aliases {
  font-style: italic;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}
.dates {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 0.15rem;
}

.chip {
  display: inline-block;
  background: rgba(140, 90, 43, 0.09);
  border: 1px solid rgba(140, 90, 43, 0.25);
  border-radius: 12px;
  padding: 0.1rem 0.55rem;
  margin: 0.1rem 0.25rem 0.1rem 0;
  font-style: normal;
}

.section-title {
  margin: 1.2rem 0 0.4rem;
  padding-top: 0.3rem;
  border-top: 1px solid var(--border);
  font-size: 1rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.relations {
  list-style: none;
  padding: 0;
  margin: 0 0 0.6rem;
}
.relations li {
  padding: 0.25rem 0;
}

/* ── Mentions cliquables dans le corps des récits ──────────── */
.mention {
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
  cursor: pointer;
}
.mention-person {
  color: #7a3a6a;
  background: rgba(122, 58, 106, 0.06);
  padding: 0 0.15rem;
  border-radius: 2px;
}
.mention-place {
  color: var(--accent-dark);
  background: rgba(140, 90, 43, 0.08);
  padding: 0 0.15rem;
  border-radius: 2px;
}
.mention:hover {
  background-color: rgba(140, 90, 43, 0.18);
}

.dialog-note {
  background: var(--banner-bg);
  border-left: 3px solid var(--accent);
  padding: 0.5rem 0.7rem;
  margin: 0.8rem 0 0;
  font-size: 0.88rem;
  color: var(--banner-fg);
  border-radius: 0 4px 4px 0;
}

/* ── UI de compression ─────────────────────────────────────── */
.compress-status {
  margin: 0.7rem 0;
  padding: 0.6rem 0.8rem;
  background: rgba(140, 90, 43, 0.06);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.compress-label {
  font-size: 0.9rem;
  color: var(--accent-dark);
  margin-bottom: 0.35rem;
}
.compress-bar {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 3px;
  overflow: hidden;
}
.compress-bar #compress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s ease;
}

/* ── Post-tagging des mentions ─────────────────────────────── */
.tag-popover {
  position: absolute;
  z-index: 1500;
}
.tag-popover button {
  padding: 0.45rem 0.8rem;
  font-size: 0.92rem;
  box-shadow: var(--shadow);
}

.tag-type-toggle {
  display: flex;
  gap: 1rem;
  margin: 0.8rem 0 0.3rem;
}
.tag-type-toggle label {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
}
.tag-type-toggle input {
  width: auto;
  min-height: auto;
  margin: 0;
}

.tag-results {
  list-style: none;
  padding: 0;
  margin: 0.2rem 0;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
}
.tag-results li {
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  font-size: 0.94rem;
}
.tag-results li:last-child { border-bottom: none; }
.tag-results li:hover { background: rgba(140,90,43,0.08); }
.tag-results li.selected { background: rgba(140,90,43,0.18); }
.tag-results .alias-hint {
  color: var(--muted);
  font-style: italic;
  font-size: 0.88rem;
}
.tag-result-empty {
  color: var(--muted);
  font-style: italic;
  padding: 0.55rem 0.7rem;
  cursor: default !important;
  background: transparent !important;
}

.tag-chosen {
  margin: 0.35rem 0 0;
  padding: 0.4rem 0.7rem;
  background: rgba(80,150,80,0.1);
  border-left: 3px solid #4a7a4a;
  color: #2a5a2a;
  border-radius: 0 3px 3px 0;
  font-size: 0.9rem;
}

/* Rend les zones de texte des récits sélectionnables de manière évidente */
.story .body {
  user-select: text;
  -webkit-user-select: text;
}

/* ── Enregistreur audio in-browser ─────────────────────────── */
.recorder {
  margin: 0.8rem 0 0.3rem;
  padding: 0.8rem 0.9rem;
  background: rgba(140, 90, 43, 0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.recorder-label {
  font-weight: 600;
  color: var(--accent-dark);
  margin-bottom: 0.55rem;
}
.recorder-body > * + * { margin-top: 0.5rem; }
.rec-live {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.rec-dot {
  width: 14px;
  height: 14px;
  background: #cc3333;
  border-radius: 50%;
  animation: pulse 1s infinite alternate;
}
@keyframes pulse {
  from { transform: scale(0.85); opacity: 0.7; }
  to   { transform: scale(1.1);  opacity: 1;   }
}
.rec-timer {
  font-family: Consolas, Menlo, monospace;
  font-size: 1rem;
  color: var(--fg);
  flex: 1;
}
.rec-preview audio {
  width: 100%;
}
.rec-preview-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.4rem;
}
.rec-ready {
  color: #4a7a4a;
  font-weight: 600;
  font-size: 0.9rem;
}
.rec-error {
  color: #a14040;
  background: rgba(161, 64, 64, 0.08);
  border: 1px solid rgba(161, 64, 64, 0.3);
  padding: 0.4rem 0.6rem;
  border-radius: 3px;
  font-size: 0.88rem;
}
.recorder-or {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  margin: 0.6rem 0 -0.3rem;
  font-size: 0.88rem;
}

/* ── Arbre généalogique ────────────────────────────────────── */
.tree-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  background: #fbf7ef;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem;
  margin: 0.4rem 0 0.6rem;
  -webkit-overflow-scrolling: touch;
}
.tree-svg {
  display: block;
  max-width: none;
}
.tree-svg .card-bg {
  fill: #fff;
  stroke: var(--border);
  stroke-width: 1;
  transition: fill 0.15s, stroke 0.15s;
}
.tree-svg .tree-card:hover .card-bg {
  fill: rgba(140, 90, 43, 0.08);
  stroke: var(--accent);
}
.tree-svg .tree-card.focus .card-bg {
  fill: rgba(140, 90, 43, 0.15);
  stroke: var(--accent);
  stroke-width: 2;
}
.tree-svg .card-name {
  fill: var(--fg);
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
}
.tree-svg .card-dates {
  fill: var(--muted);
  font-size: 11px;
  pointer-events: none;
}
.tree-svg .card-meta {
  fill: var(--muted);
  font-size: 10px;
  font-style: italic;
  pointer-events: none;
}
.tree-svg .edge {
  stroke: var(--accent-dark);
  stroke-width: 1.3;
  fill: none;
}
.tree-svg .edge-marriage {
  stroke: var(--accent);
  stroke-width: 2;
}
.tree-svg .tree-card:focus {
  outline: none;
}
.tree-svg .tree-card:focus .card-bg {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 4 2;
}
.tree-empty {
  font-style: italic;
  color: var(--muted);
  padding: 0.5rem 0;
}
.tree-full-link {
  margin: 0.3rem 0 0.8rem;
  font-size: 0.92rem;
}
.tree-full-link a {
  color: var(--accent-dark);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
}

/* ── Overlay plein écran ───────────────────────────────────── */
.tree-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.tree-overlay-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.2rem;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border);
}
.tree-overlay-title {
  flex: 1;
  font-size: 1.1rem;
}
.tree-overlay-title strong {
  color: var(--fg);
}
.tree-overlay-close {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.7rem;
  line-height: 1;
  min-height: 40px;
}
.tree-overlay-close span[aria-hidden] {
  font-size: 1.4rem;
  line-height: 0.8;
}
.tree-overlay-close .close-label {
  font-size: 0.92rem;
}
.tree-overlay-body {
  flex: 1;
  overflow: auto;
  padding: 1.2rem;
  -webkit-overflow-scrolling: touch;
}
.tree-overlay-body .tree-wrap {
  border: none;
  padding: 0;
  background: transparent;
  overflow: visible;
}
@media (max-width: 600px) {
  .tree-overlay-head {
    flex-wrap: wrap;
    padding: 0.5rem 0.8rem;
  }
  .tree-overlay-title {
    flex: 1 0 100%;
    font-size: 1rem;
    margin-bottom: 0.3rem;
  }
}

/* ── Modals ────────────────────────────────────────────────── */
dialog {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.2rem 1.4rem;
  max-width: 520px;
  width: calc(100% - 2rem);
  background: var(--panel-bg);
  color: var(--fg);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

dialog h2 {
  margin: 0 0 0.6rem;
}

dialog label {
  display: block;
  margin: 0.7rem 0;
  font-size: 0.95rem;
}

dialog input[type=text],
dialog input[type=file],
dialog textarea,
dialog select {
  font: inherit;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  min-height: 44px;
}

dialog textarea {
  resize: vertical;
  min-height: 100px;
}

dialog .coords {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

dialog .actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1rem;
}

/* ── Responsive : tablette ─────────────────────────────────── */
@media (max-width: 860px) {
  .topbar { padding: 0.6rem 0.9rem; }
  .topbar-titles h1 { font-size: 1.2rem; }
  .tagline { font-size: 0.88rem; }
}

/* ── Responsive : mobile ───────────────────────────────────── */
@media (max-width: 600px) {
  .topbar {
    padding: 0.4rem 0.7rem;
    gap: 0.3rem;
  }
  .topbar-titles h1 {
    font-size: 1.05rem;
    line-height: 1.15;
  }
  /* Le sous-titre prend de la place précieuse sur petit écran. */
  .tagline { display: none; }
  .topbar-actions {
    width: 100%;
    justify-content: stretch;
    gap: 0.35rem;
  }
  .btn-primary, .btn-ghost {
    flex: 1;
    padding: 0.45rem 0.5rem;
    font-size: 0.92rem;
  }

  .banner {
    font-size: 0.78rem;
    padding: 0.35rem 0.3rem 0.35rem 0.6rem;
  }
  .banner code { font-size: 0.85em; }

  /* Le panneau devient un bottom sheet. 72vh : assez haut pour que les
     actions d'un récit (Compléter / Modifier) soient visibles sans
     scroller, assez court pour qu'on voie encore une bonne part de la
     carte en arrière-plan. */
  .panel {
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 72vh;
    max-height: 85vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    padding: 1.1rem 1rem 3rem;
  }
  .panel[aria-hidden="false"] {
    transform: translateY(0);
  }
  .panel::before {
    /* petite barre de "drag" visuelle */
    content: '';
    display: block;
    width: 42px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: -0.6rem auto 0.6rem;
  }
  /* Bouton Fermer bien visible sur mobile (le back Android n'est pas
     toujours évident, surtout sur les surfaces plein écran). */
  .panel-close {
    top: 0.3rem;
    right: 0.5rem;
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    padding: 0.35rem 0.75rem;
    min-height: 44px;
    font-weight: 600;
  }
  .panel-close:hover,
  .panel-close:active {
    background: var(--accent-dark);
    color: #fff;
    border-color: var(--accent-dark);
  }
  .panel-close-label { font-size: 0.95rem; }

  /* Pousse un peu la carte vers le haut pour laisser la place au panneau */
  body.panel-open #map {
    filter: brightness(0.92);
  }
  /* Quand on consulte un contenu, on rend le bandeau invisible pour
     rendre tout l'espace à la lecture. Il réapparaît à la fermeture. */
  body.panel-open .banner {
    display: none;
  }

  /* Dialogs : pleine largeur confortable sur mobile */
  dialog {
    width: calc(100% - 1rem);
    padding: 1rem;
    max-height: 90vh;
    overflow-y: auto;
  }
  dialog .actions {
    flex-direction: column-reverse;
    gap: 0.5rem;
  }
  dialog .actions .btn-primary,
  dialog .actions .btn-ghost {
    width: 100%;
  }

  .banner { font-size: 0.82rem; padding: 0.5rem 0.8rem; }
}

/* ── Accessibilité : focus visible ─────────────────────────── */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
