/* ⚙️ LES PARAMÈTRES en sections (Léo, 24/10/2026 : « je veux de VRAIS
   paramètres, quand on clique ça se déballe, etc. »).

   Six sections en accordéon. L'en-tête : une icône, le titre, la ligne qui dit
   l'état actuel, un chevron. Le corps se déplie en douceur — une grille dont
   la ligne passe de 0fr à 1fr, sans hauteur à deviner — et sans animation du
   tout pour qui la refuse (`prefers-reduced-motion`). Replié, il est
   `visibility: hidden` : ni la tabulation ni un lecteur d'écran n'y entrent.

   🎨 Le thème arrive PAR-DESSUS (`design-lux` réécrit ecran.css) : AUCUNE
   couleur ni police en dur, les variables de `:root` seulement. Les icônes
   sont des MASQUES (`data:` SVG, comme les onglets) : leur couleur est celle
   du thème. Les blocs intérieurs gardent `.reglage` (ecran.css).
   Contrastes MESURÉS par script le 24/10/2026, sur les valeurs de `:root` et
   les fonds réels (texte ≥ 4,5:1, traits d'interface ≥ 3:1) : pastille
   « Branché » 5,4:1, « Non réglé » 5,2:1, « Échec » 6,1:1, « Dans la boîte »
   8,8:1 ; la ligne d'état d'un en-tête 5,6:1 survolé ; le chevron (qui dit
   ouvert / fermé) 5,6:1 ; l'anneau du clavier `--vert` 5,2:1 — celui
   d'ecran.css, depuis le 25/10/2026, pour les boutons comme pour les champs.
   Le filet des pastilles d'état est décoratif : le mot le dit. */

.param-liste { display: flex; flex-direction: column; gap: .75rem; max-width: 68rem; }
.param-section { background: var(--fond); border: 1px solid var(--trait);
  border-radius: var(--rayon-carte); scroll-margin-top: 1rem; }
.param-entete { margin: 0; font: inherit; }

/* L'en-tête : un VRAI bouton (`aria-expanded`), toute la largeur. */
.param-tete { display: flex; align-items: center; gap: .95rem; width: 100%; padding: 1rem 1.25rem;
  border: 0; border-radius: var(--rayon-carte); background: none; box-shadow: none;
  color: var(--encre); font-weight: 400; text-align: left; }
.param-section.ouverte .param-tete { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.param-tete:hover:not(:disabled) { background: var(--fond-doux); border-color: transparent; }
.param-tete:active:not(:disabled) { background: var(--fond-gris); }
.param-tete:focus-visible { outline: 3px solid var(--vert); outline-offset: -3px; }
.param-icone { flex: none; width: 2.3rem; height: 2.3rem; display: grid; place-items: center;
  border-radius: var(--rayon); background: var(--fond-gris); border: 1px solid var(--trait); }
.param-icone::before { content: ""; width: 1.1rem; height: 1.1rem; background: var(--encre-douce);
  -webkit-mask: var(--icone) no-repeat center / contain; mask: var(--icone) no-repeat center / contain; }
.param-textes { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.param-titre { font-size: 1rem; font-weight: 600; letter-spacing: -.01em; }
.param-resume { font-size: .86rem; color: var(--libelle); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.param-chevron { flex: none; width: 1.15rem; height: 1.15rem; background: var(--libelle);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat center / contain; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat center / contain;
  transition: transform .22s ease; }
.param-section.ouverte .param-chevron { transform: rotate(180deg); }
.param-section[data-section="poste"] { --icone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3'/%3E%3C/svg%3E"); }
.param-section[data-section="appels"] { --icone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1.9.4 1.8.7 2.7a2 2 0 0 1-.5 2.1L8 9.8a16 16 0 0 0 6 6l1.3-1.3a2 2 0 0 1 2.1-.4c.9.3 1.8.6 2.7.7a2 2 0 0 1 1.7 2z'/%3E%3C/svg%3E"); }
.param-section[data-section="equipe"] { --icone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M22 21v-2a4 4 0 0 0-3-3.9M16 3.1a4 4 0 0 1 0 7.8'/%3E%3C/svg%3E"); }
.param-section[data-section="leads"] { --icone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.5 5.1 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.5-6.9A2 2 0 0 0 16.8 4H7.2a2 2 0 0 0-1.7 1.1z'/%3E%3C/svg%3E"); }
.param-section[data-section="integrations"] { --icone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22v-5M9 8V2M15 8V2'/%3E%3Cpath d='M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8z'/%3E%3C/svg%3E"); }
.param-section[data-section="api"] { --icone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2'/%3E%3Cpath d='m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06'/%3E%3Cpath d='m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8'/%3E%3C/svg%3E"); }
.param-section[data-section="boite"] { --icone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m22 2-7 20-4-9-9-4z'/%3E%3Cpath d='M22 2 11 13'/%3E%3C/svg%3E"); }

/* Le corps : 0fr → 1fr. Les marges de l'intérieur restent DEDANS (son
   `overflow: hidden` les contient) : replié, rien ne dépasse d'un pixel. */
.param-corps { display: grid; grid-template-rows: 0fr; visibility: hidden;
  transition: grid-template-rows .24s ease, visibility 0s linear .24s; }
.param-section.ouverte .param-corps { grid-template-rows: 1fr; visibility: visible;
  border-top: 1px solid var(--trait-doux); transition: grid-template-rows .24s ease, visibility 0s; }
/* `position: relative` : un descendant en position absolue (le champ
   « fichier » caché des leads) est rogné avec le reste. Sans lui, il
   échappait au repli et allongeait la PAGE entière de 500 px. */
.param-interieur { position: relative; min-height: 0; overflow: hidden; padding: 0 1.25rem; }
.param-interieur > :first-child { margin-top: 1.1rem; }
.param-interieur > :last-child { margin-bottom: 1.1rem; }
.param-interieur > .reglage:last-child { padding-bottom: 0; }
.param-interieur .comptes-retour:empty { min-height: 0; margin: 0; }
.param-section.sans-animation .param-corps, .param-section.sans-animation .param-chevron { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .param-corps, .param-section.ouverte .param-corps, .param-chevron { transition: none; }
}

/* ── Les blocs ───────────────────────────────────────────────────────────── */
.param-sous-titre { margin: 1rem 0 .55rem; font-size: .88rem; font-weight: 600; color: var(--encre); }
/* ↔️ Un tableau plus large que sa carte y défile, et l'ombre au bord le dit
   (`--indice-defilement` d'ecran.css, 25/10/2026) : sur un téléphone, Équipe
   s'arrêtait sur « mot de pa », sans le moindre signe qu'il restait
   « Numéro affiché » et « Retirer ». */
.param-defile { overflow-x: auto; background: var(--indice-defilement);
  overscroll-behavior-x: contain; }
.param-defile .comptes-liste { min-width: 100%; }
.param-test-son { margin-top: .8rem; gap: .5rem 1rem; }
.param-test-son .reglage-note { margin: 0; flex: 1 1 18rem; }
.param-lien { flex: 1 1 18rem; min-width: 0; max-width: 30rem; font-family: var(--police-chiffres);
  font-size: .84rem; }
#param-reservation, #param-agenda { gap: .6rem .9rem; }
#param-reservation .reglage-note, #param-agenda .reglage-note { margin: 0; }

/* L'état d'un branchement : la pastille dit « branché » ou « à régler », le
   texte le dit aussi (jamais la couleur seule). */
/* Un lien DANS une phrase (« … : Boîte d'envoi ») : la couleur d'action du
   thème (`--vert`, 5,4:1), pas le bleu du navigateur. */
.param-renvoi { color: var(--vert); font-weight: 600; text-underline-offset: 2px; }
.param-renvoi:hover { color: var(--vert-fonce); }

.param-pastille { display: inline-flex; align-items: center; gap: .35rem; padding: .1rem .6rem;
  border: 1px solid var(--trait); border-radius: 999px; font-size: .78rem; font-weight: 600;
  line-height: 1.5; white-space: nowrap; color: var(--encre-douce); background: var(--fond-gris); }
.param-pastille::before { content: ""; flex: none; width: .45rem; height: .45rem; border-radius: 50%;
  background: currentColor; }
.param-pastille.branche { color: var(--succes); background: var(--succes-clair); border-color: var(--succes-trait); }
.param-pastille.a-regler { color: var(--ambre); background: var(--ambre-clair); border-color: var(--ambre-trait); }
.param-pastille.echec { color: var(--rouge); background: var(--rouge-clair); border-color: var(--rouge-trait); }

.param-branchements { list-style: none; margin: .25rem 0 0; padding: 0; display: grid; gap: .7rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }
.param-branchement { padding: .8rem .9rem; border: 1px solid var(--trait); border-radius: var(--rayon);
  background: var(--fond); }
.param-branchement-tete { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.param-branchement-titre { font-size: .92rem; font-weight: 600; }
.param-branchement-phrase { margin: .45rem 0 0; font-size: .84rem; color: var(--encre-douce); }

.param-plages { margin: 0; display: grid; gap: .45rem; }
.param-plage { display: flex; gap: .9rem; font-size: .9rem; }
.param-plage dt { min-width: 3.5rem; font-weight: 600; }
.param-plage dd { margin: 0; color: var(--encre-douce); }

.param-boite td { vertical-align: top; }
.param-boite td:first-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.param-boite-texte { min-width: 16rem; max-width: 30rem; color: var(--encre-douce); }
.param-erreur { display: block; margin-top: .2rem; font-size: .78rem; color: var(--rouge); }
#param-retour:empty { display: none; }

/* ── 📱 Téléphone ────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  #parametres { padding: 1rem; }
  .param-tete { gap: .75rem; padding: .85rem .9rem; }
  .param-icone { width: 2.05rem; height: 2.05rem; }
  /* Le résumé passe à la ligne autant qu'il faut plutôt que d'être coupé.
     25/10/2026 : coupé à deux lignes, il perdait sa fin — et c'est elle qui
     dit l'état (« SMS de bienvenue allu… », « vente 1… »). */
  .param-resume { white-space: normal; overflow: visible; }
  .param-interieur { padding: 0 .9rem; }
  #comptes-poser input[type=text], #comptes-poser input[type=password] { width: 100%; }
  #comptes-poser button { width: 100%; }
  .param-lien { max-width: none; flex-basis: 100%; }
  /* Les tableaux d'administration (comptes, listes) gardent leurs colonnes :
     ils défilent dans LEUR cadre, jamais la page. */
  .param-defile .comptes-liste:not(.param-boite) { min-width: 36rem; }
  .param-defile .comptes-liste:not(.param-boite) td,
  .param-defile .comptes-liste:not(.param-boite) th { white-space: nowrap; }
  /* La boîte d'envoi devient une liste de messages : quand, canal, à qui et
     l'état sur une ligne, le texte dessous, le motif en dernier. */
  .param-boite thead { display: none; }
  .param-boite, .param-boite tbody { display: block; }
  .param-boite tr { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .55rem;
    padding: .75rem 0; border-bottom: 1px solid var(--trait-doux); }
  .param-boite tr:last-child { border-bottom: 0; }
  .param-boite td { display: block; padding: 0; border: 0; font-size: .84rem; }
  .param-boite td:nth-child(1) { order: 1; color: var(--libelle); }
  .param-boite td:nth-child(2) { order: 2; font-weight: 600; }
  .param-boite td:nth-child(3) { order: 3; flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
  .param-boite td:nth-child(6) { order: 4; }
  .param-boite td:nth-child(4) { order: 5; flex: 1 0 100%; min-width: 0; max-width: none; }
  .param-boite td:nth-child(5) { order: 6; flex: 1 0 100%; color: var(--libelle); font-size: .8rem; }
}

/* 🔌 API ET WEBHOOKS (22/11/2026, api-webhooks.js). */
#reglage-api .api-ligne { flex-wrap: wrap; align-items: center; gap: .5rem .6rem; }
#reglage-api .api-code { flex: 1 1 22rem; max-width: 40rem; min-width: 0;
  font-family: var(--police-chiffres); font-size: .86rem; }
#reglage-api #api-cle-nom, #reglage-api #api-webhook-url { flex: 1 1 18rem; max-width: 30rem; min-width: 0; }
/* 🔌 « Brancher une application » : deux champs, et le message sur toute la largeur. */
#reglage-api #api-brancher-nom { flex: 1 1 12rem; max-width: 18rem; min-width: 0; }
#reglage-api #api-brancher-url { flex: 2 1 18rem; max-width: 30rem; min-width: 0; }
#reglage-api .api-message { display: block; width: 100%; max-width: none; box-sizing: border-box;
  margin-bottom: .5rem; resize: vertical; white-space: pre-wrap; overflow-wrap: anywhere;
  overflow: auto; line-height: 1.45; }
@media (max-width: 600px) {
  #reglage-api #api-brancher-nom, #reglage-api #api-brancher-url { flex-basis: 100%; max-width: none; }
}
#reglage-api .api-montre { margin: .6rem 0 .9rem; padding: .7rem .85rem; border-radius: .7rem;
  border: 1px solid var(--vert-vif); background: var(--vert-clair); }
#reglage-api .api-montre p { margin: 0 0 .5rem; font-size: .9rem; }
#reglage-api .api-montre.cache { display: none; }
#reglage-api .api-url { overflow-wrap: anywhere; font-family: var(--police-chiffres); font-size: .84rem; }
#reglage-api .api-code-court { font-family: var(--police-chiffres); font-size: .84rem; white-space: nowrap; }
#reglage-api .api-actions { white-space: nowrap; }
#reglage-api .api-actions button + button { margin-left: .35rem; }
#reglage-api td.rouge { color: var(--rouge); }
#reglage-api .api-evenements { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: .3rem .8rem; padding: .4rem 0 .2rem; }
#reglage-api #api-documentation { font-size: .9rem; white-space: nowrap; }
/* Une adresse se coupe n'importe où (un téléphone), mais pas en plein
   « luxcall » quand la place existe : la colonne garde de quoi la lire. */
@media (min-width: 701px) { #reglage-api td.api-url { min-width: 20rem; } }
@media (max-width: 700px) {
  #reglage-api .api-actions { white-space: normal; }
  #reglage-api .api-actions button { margin: .15rem .3rem .15rem 0; }
  #reglage-api .api-actions button + button { margin-left: 0; }
}

/* 🔀 Apparence (23/11/2026) : les deux styles, côte à côte ; le choisi se voit
   à son fond (jamais à sa graisse : le bouton changerait de largeur). */
.style-ecran { display: flex; flex-wrap: wrap; gap: .6rem; }
.style-ecran button[aria-pressed="true"] { background: var(--vert-clair); }

/* 🔑 LES CLÉS ET LES BRANCHEMENTS (02/12/2026, cles.js). Une carte par groupe,
   un champ par ligne : le titre au-dessus, la saisie, son état, « Retirer ». */
.cles-groupes { display: grid; gap: .9rem; align-items: start;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr)); }
.cles-groupe { min-width: 0; padding: .9rem 1rem 1rem; border: 1px solid var(--trait);
  border-radius: var(--rayon); background: var(--fond); }
.cles-groupe-titre { margin: 0 0 .25rem; font-size: .95rem; font-weight: 600; color: var(--encre); }
.cles-groupe > button { margin-top: .9rem; }
.cles-champ { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; margin-top: .7rem; }
.cles-titre { flex: 1 0 100%; font-size: .84rem; font-weight: 600; color: var(--libelle); }
.cles-champ input, .cles-champ select { flex: 1 1 14rem; min-width: 0; max-width: none; }
#cles-retour:not(:empty) { margin: 0 0 .8rem; }
.cles-secret { -webkit-text-security: disc; }
.cles-secret:placeholder-shown { -webkit-text-security: none; }
