/* ELEONE — espace client et blocs asynchrones.
 *
 * MOBILE D'ABORD : les regles de base valent pour un telephone (360 px), les media queries
 * n'ajoutent que ce qu'un ecran plus large permet. Aucune largeur fixe, aucun tableau qui
 * deborde : une donnee est une ligne « libelle / valeur » sur telephone, une colonne sur
 * grand ecran. Cibles tactiles a 44 px. Variables et couleurs : eleone.css.
 */

/* ───────────────────────── blocs charges en asynchrone ───────────────────────── */

.squelette { display: grid; gap: 10px; padding: 4px 0; }
.sq-ligne {
  display: block; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--bordure) 25%, #EFF3F8 37%, var(--bordure) 63%);
  background-size: 400% 100%;
  animation: sq-glisse 1.4s ease infinite;
}
.sq-ligne:nth-child(2) { width: 85%; }
.sq-ligne:nth-child(3) { width: 65%; }
@keyframes sq-glisse { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* Le texte « Chargement… » n'est la que pour les lecteurs d'ecran : le squelette le dit a l'oeil. */
.fragment-attente {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.fragment-en-erreur .fragment-attente { position: static; width: auto; height: auto; margin: 0; clip-path: none; }

.fragment-avis {
  display: flex; flex-direction: column; gap: 12px; align-items: flex-start;
  padding: 16px; border: 1px dashed var(--bordure); border-radius: var(--rayon);
  background: var(--fond);
}
.fragment-avis-texte { margin: 0; color: var(--texte-2); }

@media (prefers-reduced-motion: reduce) {
  .sq-ligne { animation: none; background: var(--bordure); }
}

/* Un indicateur en attente a la forme d'une carte KPI : la grille ne sautille pas quand les
   chiffres arrivent un a un. Une fois charge sans contenu (source sans chiffre), le bloc
   s'efface au lieu de laisser un trou. */
.kpi-attente[aria-busy="true"] {
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon);
  box-shadow: var(--ombre); padding: 18px; min-height: 92px;
}
.kpi-attente.fragment-charge:empty { display: none; }

/* ───────────────────────── pages publiques de commande ─────────────────────────
   Elles sont la suite d'un clic depuis le site vitrine : le visiteur n'a pas encore de
   compte, donc ni barre laterale ni menu utilisateur. Mobile d'abord. */

.entete-publique { gap: 12px; padding: 0 16px; }
.contenu-publique { max-width: 1100px; padding: 20px 16px 40px; }
.pied-public { border-top: 1px solid var(--bordure); padding: 20px 16px; text-align: center; }
.pied-public p { margin: 0; font-size: 13px; }

.commande-titre { font-size: 24px; margin: 4px 0 6px; }
.commande-gabarit {
  display: inline-block; margin-left: 4px; padding: 2px 10px; border-radius: 999px;
  background: var(--bleu-clair); color: var(--bleu-fonce); font-size: 16px; font-weight: 650;
}
.commande-sous-titre { font-size: 14px; font-weight: 650; margin: 18px 0 8px; }

.commande-caracs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.commande-caracs dt { font-size: 12px; color: var(--texte-2); }
.commande-caracs dd { margin: 2px 0 0; font-weight: 600; }

.liste-nette { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.liste-nette li { position: relative; padding-left: 20px; color: var(--texte-2); }
.liste-nette li::before { content: "✓"; position: absolute; left: 0; color: var(--succes); font-weight: 700; }
/* Ce qui n'est PAS compris se signale autrement : un client doit le lire sans se tromper. */
.liste-exclus li::before { content: "—"; color: var(--texte-3); }

.carte-prix { border-left: 4px solid var(--bleu); }
.prix-montant { font-size: 34px; font-weight: 650; letter-spacing: -.02em; margin: 0 0 2px; }
.prix-montant small { font-size: 14px; font-weight: 500; color: var(--texte-2); margin-left: 6px; }
.commande-form { margin-top: 18px; display: grid; gap: 12px; }
.commande-form .champ { max-width: 140px; }
.commande-note { margin-top: 12px; }

/* Une grille de prix se lit en descendant une colonne : le nom, ce qu'on a, ce que ca coute,
   et le bouton. Les cartes n'ont pas toutes la meme hauteur (un detail plus long, un prix de
   renouvellement en plus) — « flex » + « margin-top: auto » alignent quand meme les boutons
   sur une meme ligne, sinon l'oeil ne compare plus rien. */
.grille-offres { display: grid; gap: 12px; }
.offre-carte {
  display: flex; flex-direction: column; gap: 6px; padding: 18px;
  color: inherit; text-decoration: none;
  border: 1px solid var(--bordure); border-radius: var(--rayon); background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.offre-carte:hover, .offre-carte:focus-visible {
  border-color: var(--bleu); box-shadow: var(--ombre); text-decoration: none;
}
.offre-nom {
  font-weight: 650; font-size: 13px; color: var(--texte-2);
  text-transform: uppercase; letter-spacing: .05em;
}
.offre-carac { color: var(--texte-2); font-size: 13px; }
/* Le prix domine la carte : c'est l'information qu'on vient chercher. */
.offre-prix { font-size: 28px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; }
/* « display: block » et pas de marge laterale : la mention ne se colle pas au montant, et
   la suite de texte reste lisible telle quelle pour un lecteur d'ecran. */
.offre-prix small { display: block; font-size: 12px; font-weight: 500; color: var(--texte-2); }
.offre-prix-ttc { font-size: 12px; color: var(--texte-3); }
/* L'action ressemble a un bouton parce que c'en est une : une ligne de texte bleue ne se
   voit pas sur un telephone. La carte entiere reste cliquable. */
.offre-action {
  margin-top: auto; min-height: 44px; display: inline-flex;
  align-items: center; justify-content: center; gap: 6px;
  background: var(--bleu); color: #fff; border-radius: var(--rayon);
  font-weight: 600; font-size: 14px; padding: 0 14px;
}
.offre-carte:hover .offre-action { background: var(--bleu-fonce); }

@media (prefers-reduced-motion: reduce) {
  .offre-carte { transition: none; }
}

@media (min-width: 700px) {
  .commande-titre { font-size: 30px; }
  .commande-caracs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grille-offres { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
}

/* ───────────────────────── en-tete de l'espace ───────────────────────── */

.espace-tete { margin: 0 0 12px; }
.espace-nom { margin: 2px 0 0; font-size: 24px; line-height: 1.2; }

/* Les onglets defilent horizontalement plutot que de casser la mise en page. */
.onglets-defil {
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -16px 20px; padding: 0 16px 2px;
  -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
}
.onglets-defil::-webkit-scrollbar { display: none; }
.onglets-defil > a {
  flex: 0 0 auto; scroll-snap-align: start;
  min-height: 44px; display: inline-flex; align-items: center; padding: 0 14px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--bordure);
  color: var(--texte-2); font-weight: 600; text-decoration: none; white-space: nowrap;
}
.onglets-defil > a.actif { background: var(--noir); border-color: var(--noir); color: #fff; }

.page-intro { margin: 0 0 16px; color: var(--texte-2); max-width: 70ch; }

/* ───────────────────────── accueil : la reponse d'abord ───────────────────────── */

.accueil-phrase { margin: 0 0 8px; font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.accueil-etat { border-left: 4px solid var(--succes); }
.accueil-etat.accueil-ennui { border-left-color: var(--warning); }
.accueil-avis { border-left: 4px solid var(--inactif); }
.accueil-vide { border-left: 4px solid var(--bleu); }

.accueil-chiffres { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0 0; }
.accueil-chiffres > div { padding: 12px; background: var(--fond); border-radius: var(--rayon-petit); }
.accueil-chiffres dt { font-size: 12px; color: var(--texte-2); }
.accueil-chiffres dd { margin: 2px 0 0; font-size: 20px; font-weight: 650; }
.accueil-chiffres dd small { display: block; font-size: 11px; font-weight: 400; color: var(--texte-3); }

.actions-inline { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.actions-inline .btn { min-height: 44px; }

.liste-etats { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 8px; }
.liste-etats > li {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between;
  padding: 12px; background: var(--fond); border-radius: var(--rayon-petit);
}
.etat-nom { display: flex; flex-direction: column; min-width: 0; }
.etat-nom small { color: var(--texte-2); }

/* ───────────────────────── raccourcis (gros boutons tactiles) ───────────────────────── */

.raccourcis { display: grid; gap: 10px; margin: 20px 0 0; }
.raccourci {
  display: flex; gap: 12px; align-items: center; min-height: 64px; padding: 14px;
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon);
  text-decoration: none; color: inherit; box-shadow: var(--ombre);
}
.raccourci:hover { border-color: var(--bleu); }
.raccourci-ic {
  flex: 0 0 auto; display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: var(--rayon-petit); background: var(--bleu-clair); color: var(--bleu-fonce);
}
.raccourci strong { display: block; }
.raccourci small { color: var(--texte-2); }

/* ───────────────────────── services et machines : cartes sur telephone ───────────────────────── */

.liste-services, .liste-machines { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.service-carte, .machine-carte {
  padding: 14px; background: var(--surface); border: 1px solid var(--bordure);
  border-radius: var(--rayon); box-shadow: var(--ombre);
}
.service-carte.service-critique { border-left: 4px solid var(--critique); }
.service-carte.service-attention { border-left: 4px solid var(--warning); }

.service-tete, .machine-tete {
  display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap;
}
.service-id, .machine-id { display: flex; flex-direction: column; min-width: 0; }
.service-id strong, .machine-id strong { overflow-wrap: anywhere; }
.service-id small, .machine-id small { color: var(--texte-2); }

.service-mesures, .machine-mesures {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0 0;
}
.service-mesures > div, .machine-mesures > div { min-width: 0; }
.service-mesures dt, .machine-mesures dt { font-size: 12px; color: var(--texte-2); }
.service-mesures dd, .machine-mesures dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.service-mesures code, .machine-mesures code { font-family: var(--mono); font-size: 13px; }
.texte-alerte { color: var(--critique); font-weight: 600; }

/* ───────────────────────── documents ───────────────────────── */

.liste-docs-client { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.liste-docs-client > li > a {
  display: flex; flex-direction: column; gap: 4px; min-height: 44px; padding: 14px;
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon);
  text-decoration: none; color: inherit;
}
.liste-docs-client > li > a:hover { border-color: var(--bleu); }
.doc-titre { font-weight: 650; }
.doc-resume { color: var(--texte-2); }
.doc-meta { font-size: 12px; color: var(--texte-3); }

.doc-lecture { max-width: 72ch; }
.doc-lecture h1 { font-size: 24px; margin: 0 0 4px; }
.doc-corps { margin-top: 16px; }
.doc-corps img { max-width: 100%; height: auto; border-radius: var(--rayon-petit); }
.doc-corps pre { overflow-x: auto; padding: 12px; background: var(--fond); border-radius: var(--rayon-petit); }
.doc-corps table { display: block; overflow-x: auto; max-width: 100%; }

/* ───────────────────────── support ───────────────────────── */

.contact-principal { border-left: 4px solid var(--bleu); }
.contact-valeur { margin: 4px 0 8px; font-size: 18px; font-weight: 650; overflow-wrap: anywhere; }
.contact-liste { display: grid; gap: 10px; margin: 0; }
.contact-liste dt { font-size: 12px; color: var(--texte-2); }
.contact-liste dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.contact-liste a { min-height: 44px; display: inline-flex; align-items: center; }

/* ───────────── administration : machines rattachables a un client ───────────── */

.liste-rattachables { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }
.liste-rattachables > li {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline;
  padding: 8px 10px; background: var(--fond); border-radius: var(--rayon-petit);
}
.rattachable-nom { font-weight: 600; overflow-wrap: anywhere; }
.liste-rattachables code { font-family: var(--mono); font-size: 12px; color: var(--texte-2); overflow-wrap: anywhere; }

/* ───────────────────────── a partir de la tablette ───────────────────────── */

@media (min-width: 700px) {
  .espace-nom { font-size: 28px; }
  .onglets-defil { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
  .accueil-chiffres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .raccourcis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .service-mesures, .machine-mesures { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .liste-docs-client { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1100px) {
  .accueil-phrase { font-size: 22px; }
  .liste-services, .liste-machines { gap: 8px; }
}
