/* Connexions (#/connexions) : prototype Connexions.dc.html et ConnexionsMobile.dc.html.
   Styles propres à cet écran (refonte du prototype v73) : un fichier par écran, chargé par index.html après
   shell.css. Téléphone : @media (max-width: 767px), comme la coque.
   Les anciennes règles `.cx-*` d'app.css (lignes « Connexions » et leur @media 640px) sont surchargées ici, sous
   `.cx-page` (la page de l'écran). */

/* ---- En-tête, état, encart, message */
.cx-page .cx-head { margin-bottom: 24px; }
.cx-page .cx-head .page-head__text { flex: 1 1 360px; min-width: 0; max-width: 64ch; }
.cx-page .cx-lede { margin: 8px 0 0; font-size: 16px; color: var(--app-muted); }
.cx-pill-todo { display: none; }
.cx-status { margin: 0; font-size: 14px; color: #5A6B60; }
.cx-encart { margin-top: 12px; padding: 12px 16px; border-radius: 12px; background: #EEF2EF; font-size: 14px; color: var(--app-ink); }
.cx-encart p { margin: 0; }
.cx-encart p + p { margin-top: 4px; }
.cx-encart__title { font-weight: 600; }
.cx-note { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 12px 16px;
  border-radius: 12px; background: var(--app-ok-bg); color: var(--app-ok-ink); font-size: 14px; font-weight: 600; }
.cx-note--warn { background: var(--app-warn-bg); color: var(--app-warn-ink); }
.cx-note__x { flex: none; min-width: 32px; min-height: 32px; border: 0; border-radius: 8px; background: transparent; color: inherit;
  font: inherit; font-size: 18px; line-height: 1; cursor: pointer; }
.cx-note__x:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
.cx-marques { margin: 12px 0 0; font-size: 14px; color: #5A6B60; }

/* ---- Cartes par plateforme */
.cx-page .cx-groups { gap: 12px; margin-top: 16px; }
.cx-page .cx-group__head { gap: 14px; padding: 14px 16px; }
.cx-page .cx-group__name .strong { font-size: 17px; font-weight: 700; }
.cx-page .cx-group__name .sub { font-size: 14px; color: var(--app-muted); }

/* Une connexion : sous le logo (décalage du prototype), ses restaurants ou son guide et la saisie de l'accès */
.cx-page .cx-conns { border-top: 0; }
.cx-page .cx-conn { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 14px 126px; border-top: 1px solid var(--app-line); }
.cx-page .cx-conn:first-child { border-top: 1px solid var(--app-line); }
.cx-page .cx-conn--empty { gap: 12px; }
.cx-conn__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; }
.cx-conn__head--solo { display: none; }                  /* une seule connexion : la barre de la carte suffit */
.cx-page .cx-conn__id { flex: 1 1 240px; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; overflow-wrap: anywhere; }
.cx-conn__name { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.cx-conn__name .strong { font-weight: 600; }
.cx-conn__meta { font-size: 13px; color: var(--app-muted); }
.cx-page .cx-conn__acts { flex: none; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.cx-conn__acts .btn--ghost { color: #224656; }
.cx-error { margin: 0; font-size: 14px; font-weight: 600; color: #B44836; }
.cx-saved, .cx-wait { margin: 0; font-size: 14px; color: var(--app-muted); }

/* Guide pour brancher */
.cx-steps { max-width: 72ch; margin: 0; padding-left: 20px; list-style: decimal; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }

/* Restaurants détectés : tableau en grille au bureau */
.cx-restos { max-width: 820px; }
.cx-restos__title { display: none; }
.cx-restos__head, .cx-restos__list > li { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr) minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; }
.cx-restos__head { padding-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--app-muted); }
.cx-restos__list { margin: 0; padding: 0; list-style: none; }
.cx-restos__list > li { align-items: center; padding: 7px 0; border-top: 1px solid #EEF2EA; font-size: 14px; }
.cx-r__name { font-weight: 600; overflow-wrap: anywhere; }
.cx-r__state .badge { padding: 3px 10px; }

/* Saisie de l'accès */
.cx-form { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; max-width: 640px; }
.cx-form__fields { display: flex; flex-wrap: wrap; gap: 10px 12px; width: 100%; }
.cx-field { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cx-field label { font-size: 14px; font-weight: 600; }
.cx-input { min-height: 40px; padding: 0 12px; box-sizing: border-box; border: 1px solid #A6B0A9; border-radius: 8px; background: #FFFFFF;
  color: var(--app-ink); font: inherit; font-size: 15px; }
.cx-input[aria-invalid] { border-color: #B44836; }
.cx-input:focus-visible { outline: 2px solid var(--app-primary); outline-offset: 1px; }
.cx-field__err { margin: 0; font-size: 13px; font-weight: 600; color: #B44836; }
.cx-form__hint { margin: 0; font-size: 13px; color: var(--app-muted); }
.cx-form__acts { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.cx-form .btn--secondary { border-color: var(--app-line); color: #101814; }

/* Où écrire les chiffres */
.cx-dest { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 14px 126px; border-top: 1px solid var(--app-line); }
.cx-dest__pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.cx-dest__label { margin-right: 6px; font-size: 14px; font-weight: 600; }
.cx-dest__pill { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border: 1px solid var(--app-line); border-radius: 999px;
  background: #FFFFFF; color: var(--app-ink); font: inherit; font-size: 13px; font-weight: 600; line-height: 1.2; cursor: pointer; }
.cx-dest__pill[aria-pressed="true"] { border-color: #1F6B3A; background: #E3F0E7; color: #12543A; }
.cx-dest__pill:focus-visible { outline: 2px solid var(--app-primary); outline-offset: 2px; }
.cx-dest__line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 14px; }
.cx-dest__name { font-weight: 600; overflow-wrap: anywhere; }
.cx-dest__meta { color: var(--app-muted); }

/* Changer les identifiants, ajouter un compte */
.cx-page .cx-more-acct { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 6px 16px 8px 118px; border-top: 1px solid var(--app-line); }
.cx-more-acct .btn--ghost { color: #224656; }

/* Téléphone et tablette (le doigt, jusqu'à 1 199 px ; audit EC-13) : pastilles « Où écrire les chiffres » touchées sur
   44 px, même dessin (fos-slow-9) */
@media (max-width: 1199px) {
  .cx-dest__pill { position: relative; }
  .cx-dest__pill::before { content: ""; position: absolute; inset: -6px 0; }
}

/* ---- Téléphone : la maquette ConnexionsMobile */
@media (max-width: 767px) {
  .cx-page .cx-head { flex-wrap: nowrap; align-items: center; gap: 12px; margin-bottom: 12px; }
  .cx-page .cx-head .page-head__text { flex: 1 1 auto; }
  .cx-page .cx-head h1 { line-height: 1.2; }
  .cx-page .cx-lede, .cx-status, .cx-encart { display: none; }
  .cx-pill-todo { flex: none; margin: 0; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
    font-size: 14px; font-weight: 700; white-space: nowrap; }
  .cx-pill-todo::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; }
  .cx-pill-todo--warn { background: var(--app-warn-bg); color: var(--app-warn-ink); }
  .cx-pill-todo--warn::before { background: var(--app-warn-dot); }
  .cx-pill-todo--ok { background: var(--app-ok-bg); color: var(--app-ok-ink); }
  .cx-pill-todo--ok::before { background: var(--app-ok-dot); }
  .cx-page .cx-groups { gap: 10px; margin-top: 0; }                  /* ConnexionsMobile : 10 px entre les cartes */

  /* Barre de la carte : logo 48 × 32, nom puis pastille, interrupteur (zone 52 × 44), chevron */
  .cx-page .cx-group__head { display: grid; grid-template-columns: 48px minmax(0, 1fr) 52px 28px;
    grid-template-areas: "logo name sw chev" "logo badge sw chev"; gap: 4px 10px; align-items: center; min-height: 68px;
    padding: 10px 6px 10px 12px; box-sizing: border-box; }
  .cx-page .cx-logo { grid-area: logo; width: 48px; height: 32px; padding: 3px 4px; border-radius: 8px; }
  .cx-page .cx-group__name { grid-area: name; align-self: end; }
  /* le nom passe à la ligne plutôt que d'être coupé (« OneDrive / ShareP… » à 360 px, audit EC-14) */
  .cx-page .cx-group__name .strong { font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
  .cx-page .cx-group__name .sub { display: none; }
  .cx-page .cx-group__head > .badge { grid-area: badge; justify-self: start; align-self: start; gap: 5px; padding: 3px 8px; font-size: 12px; font-weight: 700; line-height: 1.3; }
  .cx-page .cx-group__head > .badge::before { width: 6px; height: 6px; }
  .cx-page .cx-group__head > .switch { grid-area: sw; justify-self: center; margin: 0; }
  .cx-page .cx-group__head > .switch::before { content: ""; position: absolute; inset: -9px -3px; }   /* doigt : 52 × 44 */
  .cx-page .cx-group__head::after { grid-area: chev; justify-self: center; margin: 0; }

  /* Dépli : chaque connexion en ligne (nom, réussite, état), puis ses restaurants en pastilles */
  .cx-page .cx-conn, .cx-page .cx-conn:first-child { gap: 10px; padding: 8px 14px 12px; border-top-color: #EEF2EA; }
  .cx-page .cx-conn__head, .cx-page .cx-conn__head--solo { display: flex; min-height: 40px; }
  .cx-page .cx-conn__id { flex-wrap: nowrap; justify-content: space-between; gap: 10px; }
  .cx-conn__name { flex-direction: column; align-items: flex-start; gap: 2px; }
  .cx-conn__name .strong { font-size: 15px; font-weight: 700; line-height: 1.3; }
  .cx-page .cx-conn__id > .badge { flex: none; gap: 5px; padding: 3px 8px; font-size: 12px; font-weight: 700; line-height: 1.3; }
  .cx-page .cx-conn__id > .badge::before { width: 6px; height: 6px; }
  .cx-page .cx-conn__acts { flex: 1 1 100%; }
  .cx-conn--drive .cx-conn__acts .btn { flex: 1 1 auto; min-height: 44px; border: 1px solid var(--app-line); background: #FFFFFF; }
  .cx-restos { margin: 2px -14px 0; padding: 12px 14px 0; border-top: 1px solid #EEF2EA; }
  .cx-restos__title { display: block; margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--app-muted); }
  .cx-restos__head { display: none; }
  .cx-restos__list { display: flex; flex-wrap: wrap; gap: 6px; }
  .cx-restos__list > li { display: block; padding: 4px 10px; border: 1px solid var(--app-line); border-radius: 999px; background: var(--app-bg); font-size: 13px; }
  .cx-r__name { font-weight: 400; }
  .cx-r__state, .cx-r__last, .cx-r__count { display: none; }
  .cx-steps { padding-left: 20px; line-height: 1.45; gap: 8px; }
  .cx-input { min-height: 48px; font-size: 16px; }
  .cx-form, .cx-form__acts { width: 100%; }
  .cx-form__acts .btn { flex: 1 1 auto; min-height: 48px; }
  .cx-conn--empty > .cx-form__acts .btn { min-height: 52px; font-size: 16px; }
  .cx-dest { padding: 12px 14px; border-top-color: #EEF2EA; }

  /* Ajouter un compte : une ligne pleine largeur, avec « + » */
  .cx-page .cx-more-acct { display: block; padding: 0; border-top-color: #EEF2EA; }
  .cx-page .cx-more-acct .btn { display: flex; justify-content: flex-start; gap: 8px; width: 100%; min-height: 48px; padding: 0 14px;
    border-radius: 0; font-size: 15px; text-align: left; }
  .cx-page .cx-more-acct .btn + .btn { border-top: 1px solid #EEF2EA; }
  .cx-page .cx-more-acct .btn:last-child::before { content: "+"; font-size: 20px; line-height: 1; }

  /* Message : au-dessus de la barre du bas */
  .cx-note { position: fixed; z-index: 40; left: 50%; bottom: 84px; transform: translateX(-50%); width: calc(100% - 32px); max-width: 398px;
    box-sizing: border-box; align-items: center; gap: 8px; margin: 0; padding: 4px 4px 4px 14px; background: #12543A; color: #FFFFFF;
    box-shadow: 0 8px 24px rgb(0 0 0 / .2); }
  .cx-note--warn { background: var(--app-warn-ink); color: #FFFFFF; }
  .cx-note > span { flex: 1 1 auto; min-width: 0; }
  .cx-note__x { width: 44px; height: 44px; border-radius: 10px; font-size: 20px; }
  .cx-marques { margin-top: 16px; font-size: 12px; text-align: center; color: var(--app-muted); }
}
