/* Couleurs de l'agence. --accent est un turquoise foncé : le blanc se lit mal sur #1cba9f. */
:root { --turquoise: #1cba9f; --bleu: #548dc9; --marine: #223a66; --accent: #0b7a6a; --fond: #f3f7f9; --carte: #fff; --texte: #1f2b3d; --doux: #54616f; --bord: #d6dfe6; --pale: #e8f6f3; --danger: #a32020; --barre: 0px; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--fond); color: var(--texte); font: 16px/1.45 system-ui, "Segoe UI", sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.4rem; margin: 0 0 1rem; color: var(--marine); }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* En-tête */
.haut { background: #fff; display: flex; align-items: center; gap: .5rem 1.5rem; padding: .5rem 1rem; border-top: 5px solid; border-image: linear-gradient(90deg, var(--turquoise), var(--bleu)) 1; box-shadow: 0 1px 4px #223a6626; }
.marque { display: flex; align-items: center; gap: .8rem; text-decoration: none; color: var(--marine); font-weight: 700; flex: none; }
.marque img { display: block; }
.marque span { border-left: 1px solid var(--bord); padding-left: .8rem; }
.menu { display: flex; align-items: center; gap: .2rem .3rem; flex: 1; }
.menu a { color: var(--marine); text-decoration: none; padding: .55rem .6rem; border-radius: 8px; white-space: nowrap; }
.menu a:hover { background: var(--pale); }
.menu a[aria-current] { background: var(--pale); color: var(--accent); font-weight: 700; }
.fin { margin-left: auto; display: flex; gap: .5rem; align-items: center; }
.fin a { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; }
.fin button { white-space: nowrap; }
.hamburger { display: none; position: relative; border: 0; padding: .6rem; line-height: 0; color: var(--marine); }
.barre { display: none; }
.voile { position: fixed; inset: 0; background: #14233f80; z-index: 8; }
.essai { background: #fff3cd; color: #5b4300; padding: .3rem 1rem; text-align: center; font-size: .85rem; }

/* Contenu */
main { padding: 1rem; max-width: 1700px; margin: auto; }
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
.carte > p:first-child { margin-top: 0; }
.etroite { max-width: 44rem; margin: 1rem auto; }
label:has(> textarea.sms) { margin-top: .8rem; }
.annonce { padding: .6rem 1rem; border-radius: 8px; margin-bottom: 1rem; background: #dff3e4; color: #14532d; }
.annonce.erreur { background: #fbe3e3; color: #7a1414; }
.doux { color: var(--doux); font-size: .9rem; }
.message { background: var(--pale); border-radius: 12px; padding: .8rem; overflow-wrap: anywhere; }
.titre { display: flex; flex-wrap: wrap; gap: .7rem 1rem; align-items: center; margin-bottom: 1rem; }
.titre h1 { margin: 0; }
.titre > .bouton:first-of-type { margin-left: auto; }
.actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1rem; align-items: center; }
.cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
summary { cursor: pointer; padding: .6rem 0; font-weight: 600; }

/* Formulaires */
label { display: block; font-weight: 600; font-size: .9rem; }
input, select, textarea, button, .bouton { font: inherit; padding: .5rem .8rem; border: 1px solid #8795a3; border-radius: 8px; min-height: 44px; }
input:not([type=checkbox], [type=radio]), select, textarea { width: 100%; background: #fff; color: inherit; margin-top: .2rem; }
input[type=checkbox], input[type=radio] { min-height: 0; width: 1.3rem; height: 1.3rem; vertical-align: middle; margin: 0 .4rem 0 0; accent-color: var(--accent); }
textarea { min-height: 5.5rem; resize: vertical; }
textarea.sms { min-height: 10rem; }
button, .bouton { background: #fff; color: var(--accent); border-color: var(--accent); cursor: pointer; text-decoration: none; display: inline-block; font-weight: 600; }
button:hover, .bouton:hover { background: var(--pale); }
.principal, .principal:hover { background: var(--accent); color: #fff; }
.danger { color: var(--danger); border-color: var(--danger); }
button:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 3px solid #f4ae44; outline-offset: 2px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.champs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: .9rem; }
.large { grid-column: 1 / -1; }
.filtres { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr)); gap: .7rem; align-items: end; }
#plus-filtres { display: none; }
.selection { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; position: sticky; top: 0; z-index: 2; }

/* Tableaux */
.defile { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--bord); vertical-align: top; }
th { vertical-align: middle; color: var(--marine); }
th button, th button:hover { border: 0; padding: 0; min-height: 32px; font-weight: 700; color: inherit; background: none; }
th[aria-sort=ascending] button::after { content: " ▲"; }
th[aria-sort=descending] button::after { content: " ▼"; }
#liste td { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#liste tbody tr:hover { background: var(--pale); }
#liste .c-telephone a { color: inherit; }
.fusion td { min-width: 12rem; overflow-wrap: anywhere; }
.fusion label { font-weight: 400; display: flex; gap: .5rem; align-items: flex-start; }
.fusion input[type=radio] { flex: none; margin: 0; }

/* Messages */
.pastille { background: var(--danger); color: #fff; border-radius: 99px; padding: .05rem .45rem; font-size: .75rem; margin-right: .35rem; }
.alerte { color: var(--danger); font-size: .8rem; }
.recherche { margin-top: 0; align-items: end; }
.recherche label:first-of-type { flex: 1 1 14rem; }
.conversations { list-style: none; padding: 0 !important; margin-top: 0; overflow: hidden; }
.conversations li { border-bottom: 1px solid var(--bord); }
.conversations li:last-child { border: 0; }
.conversations li:not(:has(a)) { padding: 1rem; }
.conversations a { display: grid; grid-template-columns: 1fr auto; gap: .1rem .8rem; padding: .7rem 1rem; color: inherit; text-decoration: none; }
.conversations a:hover { background: var(--pale); }
.conversations time, .conversations .extrait { color: var(--doux); font-size: .9rem; }
.conversations time, .conversations a > span:last-child { text-align: right; }
.conversations .qui, .conversations .extrait { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversations .nouveau .qui, .conversations .nouveau .extrait { font-weight: 700; color: var(--texte); }
.conversations .pastille { margin: 0; }
.fil { display: flex; flex-direction: column; gap: .6rem; }
.bulle { max-width: min(85%, 40rem); padding: .6rem .9rem; border-radius: 14px; overflow-wrap: anywhere; }
.bulle.recu { align-self: flex-start; background: #e9eef3; }
.bulle.envoye { align-self: flex-end; background: var(--pale); }
.bulle small { display: block; color: var(--doux); margin-top: .2rem; }
.postes { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; }
.postes legend { font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.postes label { font-weight: 400; min-height: 32px; }
/* Proposition à la clinique et page de choix */
.carte-interne { border-top: 1px solid var(--bord); margin-top: 1rem; padding-top: .3rem; }
.carte-interne fieldset, .candidats-choix { margin-bottom: 1rem; }
.carte-interne legend, .candidats-choix legend { font-weight: 600; font-size: .9rem; margin-bottom: .4rem; }
label.case { font-weight: 400; padding: .3rem 0; }
.option-candidat { display: flex; gap: .7rem; align-items: flex-start; font-weight: 400; font-size: 1rem; border: 1px solid var(--bord); border-radius: 12px; padding: .8rem; margin-bottom: .6rem; cursor: pointer; }
.option-candidat:has(input:checked) { border-color: var(--accent); background: var(--pale); }
.option-candidat input { flex: none; margin-top: .15rem; }
.option-candidat .doux { display: block; margin-top: .3rem; }
.etiquette { display: inline-block; margin-left: .4rem; padding: .1rem .5rem; border-radius: 999px; background: var(--accent); color: #fff; font-size: .8rem; }
.postes p { flex-basis: 100%; margin: 0; }

/* Menu latéral : téléphone, tablette et petits écrans */
@media (max-width: 1560px) {
  .hamburger { display: block; order: -1; }
  .menu { position: fixed; inset: 0 auto 0 0; width: min(19rem, 85vw); background: #fff; z-index: 9; flex-direction: column; align-items: stretch; padding: 1rem; padding-top: max(1rem, env(safe-area-inset-top)); overflow-y: auto; visibility: hidden; transform: translateX(-100%); transition: transform .18s, visibility .18s; }
  .menu.ouvert { visibility: visible; transform: none; transition: transform .18s; box-shadow: 0 0 30px #14233f66; }
  .hamburger .pastille { position: absolute; top: 0; right: -2px; margin: 0; line-height: 1.4; }
  .menu a { padding: .8rem; }
  .fin { margin: auto 0 0; flex-direction: column; align-items: stretch; border-top: 1px solid var(--bord); padding-top: .7rem; }
  .fin button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .menu, .menu.ouvert { transition: none; } }

/* Téléphone */
@media (max-width: 700px) {
  .avec-barre { --barre: calc(60px + env(safe-area-inset-bottom)); padding-bottom: var(--barre); }
  .avec-barre .fin a { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; }
.fin button { white-space: nowrap; }
.hamburger { display: none; position: relative; }
  .haut { justify-content: center; position: sticky; top: 0; z-index: 7; padding: .35rem .8rem; } /* au-dessus de .barre : contient le menu et le voile */
  .marque img { width: 105px; height: 34px; }
  .barre { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 0 0; z-index: 6; background: #fff; border-top: 1px solid var(--bord); padding-bottom: env(safe-area-inset-bottom); }
  .barre a, .barre button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 59px; padding: 0; border: 0; border-radius: 0; background: none; font-size: .75rem; font-weight: 600; color: var(--doux); text-decoration: none; }
  .barre a { position: relative; }
  .barre .pastille { position: absolute; top: 4px; left: 50%; margin: 0 0 0 6px; }
  .barre [aria-current] { color: var(--accent); box-shadow: inset 0 3px var(--turquoise); }
  main { padding: .8rem; }
  .carte { padding: .8rem; }
  .etroite { margin-top: 0; }
  .actions > button, .actions > .bouton { flex: 1 1 auto; text-align: center; }

  #plus-filtres { display: block; }
  .filtres { grid-template-columns: 1fr 1fr; }
  .filtres .partout { grid-column: 1 / -1; }
  .filtres:not(.ouverts) > .detail { display: none; }
  #plus-filtres { grid-column: 1 / -1; }

  .selection { top: auto; bottom: calc(var(--barre) + .4rem); z-index: 4; gap: .5rem; padding: .5rem; box-shadow: 0 2px 14px #14233f40; position: sticky; }
  .selection strong { flex: 1 0 100%; text-align: center; }
  .selection button { flex: 1; padding: .4rem; font-size: .85rem; }

  /* Chaque ligne de tableau devient une carte. */
  .defile { overflow: visible; }
  table:not(.fusion) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table:not(.fusion), table:not(.fusion) tbody { display: block; }
  table:not(.fusion) tr { display: block; padding: .6rem 0; border-bottom: 1px solid var(--bord); }
  table:not(.fusion) tr:last-child { border-bottom: 0; }
  table:not(.fusion) td { display: block; border: 0; padding: .1rem 0; overflow-wrap: anywhere; }
  td[data-t]:not(:empty)::before { content: attr(data-t) " : "; color: var(--doux); }
  .defile:has(.fusion) { overflow-x: auto; }
  #liste tr { display: grid; grid-template-columns: 2.4rem 1fr auto; column-gap: .3rem; align-items: center; }
  #liste[data-corbeille="1"] tr { grid-template-columns: 0 1fr auto; }
  #liste td { max-width: none; white-space: normal; grid-column: 2 / -1; }
  #liste td:empty, #liste .c-courriel, #liste .c-notes, #liste .c-exigences, #liste .c-maj, #liste .c-abonne { display: none; }
  #liste .c-choix { grid-area: 1 / 1 / 4 / 2; padding: .8rem 0; }
  #liste .c-nom { grid-area: 1 / 2; }
  #liste .c-nom a { font-weight: 700; display: block; padding: .5rem 0; text-decoration: none; }
  #liste .c-telephone { grid-area: 1 / 3; }
  #liste .c-telephone a { display: block; padding: .6rem 0; color: var(--accent); }
}