/* Garde-robe — Proposer une tenue (htdocs/assets/garderobe/proposition.css). Cahier « Proposer une tenue » § 2.2–2.6.
   La feuille .po-feuille (GR.feuille), son contenu .po (une phase à la fois) et son pied .po-pied-<phase>. Les cartes
   des propositions : la planche du socle (GR.planche, .g-planche.po-planche) à gauche, 88 px au téléphone, 104 au
   bureau ; nom, pourquoi, pièces et gestes à droite. Cibles de 44 au moins ; un coût (.po-somme) ne se coupe jamais de
   son unité. Couleurs : jetons seulement.
   Le sélecteur « Choisir des pièces » (feuille .po-choix poussée au-dessus, racine .po-ch) : barre collée (recherche,
   puces des catégories), grille de cellules (g-cellule : 3 colonnes au téléphone, 4 au bureau), pied à deux étages (le
   compteur et la phrase discrète, puis « Annuler » et « Valider »). */

/* ---------------- Commun ---------------- */
.po-feuille .po { display: flex; flex-direction: column; gap: 24px; padding: 4px 0 8px; min-width: 0; }
.po-feuille .po-somme { white-space: nowrap; }
.po-feuille .po-environ { width: 14px; height: 14px; vertical-align: -2px; margin-right: 1px; }
.po-tourne { animation: po-tourne 800ms linear infinite; }
@keyframes po-tourne { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .po-tourne { animation: none; } }
.po-feuille .po-facultatif { margin-left: 4px; font: 500 13px/18px var(--gr-sans); color: var(--gr-texte-3); }
.po-feuille .po-aide { margin: 8px 0 0; font: 500 13px/18px var(--gr-sans); color: var(--gr-texte-2); }
.po-feuille .po-erreur {
    display: flex; gap: 8px; align-items: flex-start; margin: 0 var(--gr-marge); padding: 12px 14px; border-radius: var(--r-ctrl);
    background: var(--gr-danger-doux); color: var(--gr-danger); font: 500 15px/21px var(--gr-sans); overflow-wrap: anywhere;
}
.po-feuille .po-erreur > .g-ic, .po-feuille .po-alerte > .g-ic, .po-feuille .po-motif > .g-ic,
.po-feuille .po-carte-erreur > .g-ic, .po-feuille .po-avertissements .g-ic { flex: none; margin-top: 1px; }
.po-feuille .po-cout-essai { margin: -16px var(--gr-marge) 0; font: 500 13px/18px var(--gr-sans); color: var(--gr-texte-2); font-variant-numeric: tabular-nums; }

/* ---------------- Chargement ---------------- */
.po-feuille .po[aria-busy="true"] { gap: 12px; padding: 4px var(--gr-marge) 8px; }
.po-feuille .po[aria-busy="true"] > .g-squelette.ligne { margin-top: 0; }
.po-feuille .po-sq-zone { height: 100px; width: 100%; border-radius: var(--r-ctrl); }
.po-feuille .po-sq-puces { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.po-feuille .po-sq-puce { width: 84px; height: 36px; border-radius: 18px; }

/* ---------------- Refus, maigre ---------------- */
.po-feuille .po-motif { display: flex; gap: 8px; align-items: flex-start; margin: 8px var(--gr-marge) 0; font: 500 15px/21px var(--gr-sans); color: var(--gr-texte-2); overflow-wrap: anywhere; }
.po-feuille .po-maigre { align-items: center; text-align: center; gap: 12px; padding: 32px var(--gr-marge) 8px; }
.po-feuille .po-maigre > .t-titre { margin: 0; }
.po-feuille .po-texte { margin: 0; max-width: 34ch; font: 500 15px/22px var(--gr-sans); color: var(--gr-texte-2); }

/* ---------------- Formulaire (§ 2.3) ---------------- */
.po-feuille .po-chapo { margin: 0 var(--gr-marge); font-size: 15px; line-height: 22px; color: var(--gr-texte-2); }
.po-feuille .po-section { display: flex; flex-direction: column; margin: 0 var(--gr-marge); min-width: 0; }
.po-feuille .po-section > .g-libelle { margin-bottom: 10px; }
.po-feuille .po-section > textarea { width: 100%; }
/* Les pièces imposées : de petites cartes (vignette, nom sur deux lignes, croix dans le coin), rangées de haut en bas ;
   toute la carte est la cible (68 × 106 au moins). Quatre par rangée à 375 (≈ 74 px), les six d'une rangée au bureau.
   Puis le bouton du sélecteur, à gauche. */
.po-feuille .po-imposees {
    list-style: none; margin: 0 0 16px; padding: 6px 6px 0 0; min-width: 0;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 14px 10px;
}
.po-feuille .po-imposees[hidden] { display: none; }
.po-feuille .po-imp-li { display: block; min-width: 0; }
.po-feuille .po-imp {
    position: relative; display: block; width: 100%; padding: 0; margin: 0; border: 0; background: none; text-align: left;
    color: var(--gr-texte); border-radius: var(--r-ctrl); cursor: pointer; touch-action: manipulation;
    -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
    transition: transform var(--d-instant) var(--c-standard);
}
.po-feuille .po-imp:active { transform: scale(.96); }
.po-feuille .po-imp:focus-visible { outline: 2px solid var(--gr-focus); outline-offset: 4px; border-radius: 12px; }
.po-feuille .po-imp-visuel { position: relative; display: block; border-radius: var(--r-tirage); }
.po-feuille .po-imp-x {
    position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%;
    display: grid; place-items: center; background: var(--gr-texte); color: var(--gr-inverse); box-shadow: 0 0 0 2px var(--gr-surface);
    transition: transform var(--d-court) var(--c-ressort);
}
.po-feuille .po-imp-x > .g-ic { width: 14px; height: 14px; stroke-width: 2.25; }
.po-feuille .po-imp-nom {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    margin-top: 6px; font: 600 13px/16px var(--gr-sans); overflow-wrap: anywhere; -webkit-hyphens: auto; hyphens: auto;
}
@media (hover: hover) { .po-feuille .po-imp:hover .po-imp-x { transform: scale(1.12); } }
.po-feuille .po-choisir { align-self: flex-start; max-width: 100%; }
.po-feuille .po-choisir > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.po-feuille .po-avec .po-refus { margin: 4px 0 0; font: 500 13px/18px var(--gr-sans); color: var(--gr-attention); overflow-wrap: anywhere; }
.po-feuille .po-avec .po-refus:empty { margin: 0; }
.po-feuille .po-cases { display: flex; flex-direction: column; }
.po-feuille .po-nombre { padding: 0; }
.po-feuille .po-alerte {
    display: flex; gap: 8px; align-items: flex-start; margin: 0 var(--gr-marge); padding: 12px 14px; border-radius: var(--r-ctrl);
    background: var(--gr-danger-doux); color: var(--gr-danger); font: 500 15px/21px var(--gr-sans); overflow-wrap: anywhere;
}
.po-feuille .po-alerte[hidden] { display: none; }
/* Des propositions arrivées pendant que la feuille montrait une autre demande : un bandeau en tête du formulaire,
   « Voir » à droite (il passe dessous quand la place manque). */
.po-feuille .po-pretes {
    display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0 var(--gr-marge); padding: 10px 10px 10px 14px;
    border-radius: var(--r-ctrl); border: 1px solid var(--gr-ligne); background: var(--gr-surface); color: var(--gr-texte);
}
.po-feuille .po-pretes > .g-ic { flex: none; }
.po-feuille .po-pretes-texte { flex: 1 1 12em; display: flex; flex-direction: column; min-width: 0; font: 600 15px/21px var(--gr-sans); overflow-wrap: anywhere; }
.po-feuille .po-pretes-texte > small { font: 500 13px/18px var(--gr-sans); color: var(--gr-texte-2); }
.po-feuille .po-pretes > .g-bouton { flex: none; }
/* Après un échec : revenir aux propositions d'avant (un lien texte sous le message). */
.po-feuille .po-revoir { margin: -12px var(--gr-marge) 0; }
/* Le libellé passe à la ligne plutôt que de déborder (320 px) ; l'icône reste en haut à gauche. */
.po-feuille .po-revoir > .g-bouton.texte {
    margin-left: -12px; max-width: calc(100% + 12px); height: auto; min-height: 44px; padding-top: 10px; padding-bottom: 10px;
    gap: 6px; white-space: normal; text-align: left; line-height: 22px; justify-content: flex-start;
}
.po-feuille .po-revoir .g-ic { width: 18px; height: 18px; }

/* ---------------- Attente et résultats (§ 2.4, 2.5) ---------------- */
.po-feuille .po-statut { margin: 0 var(--gr-marge); font: 600 17px/24px var(--gr-sans); overflow-wrap: anywhere; }
.po-feuille .po-statut-detail { display: block; margin-top: 2px; font: 500 13px/18px var(--gr-sans); color: var(--gr-texte-2); font-variant-numeric: tabular-nums; }
.po-feuille .po-remarque { margin: -8px var(--gr-marge) 0; font-size: 17px; line-height: 24px; overflow-wrap: anywhere; }
.po-feuille .po-avertissements { list-style: none; margin: -8px var(--gr-marge) 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.po-feuille .po-avertissements > li { display: flex; gap: 8px; align-items: flex-start; font: 500 13px/18px var(--gr-sans); color: var(--gr-texte-2); overflow-wrap: anywhere; }
.po-feuille .po-avertissements .g-ic { width: 16px; height: 16px; }
.po-feuille .po-cartes { list-style: none; margin: 0 var(--gr-marge); padding: 0; display: flex; flex-direction: column; gap: 0; }
.po-feuille .po-carte {
    display: grid; grid-template-columns: 88px minmax(0, 1fr); column-gap: 14px; align-items: start; padding: 16px 0;
    border-top: 1px solid var(--gr-ligne);
}
.po-feuille .po-carte:first-child { border-top: 0; padding-top: 0; }
.po-feuille .g-planche.po-planche { width: 88px; padding: 8px; }
.po-feuille .po-sq-planche { width: 88px; aspect-ratio: 3 / 4; }
.po-feuille .po-carte-texte { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.po-feuille .po-carte-sq .g-squelette.ligne:first-child { margin-top: 4px; width: 80%; height: 18px; }
.po-feuille .po-nom { margin: 0; font: 400 22px/28px var(--gr-serif); overflow-wrap: anywhere; }
.po-feuille .po-pourquoi { margin: 0; font: 500 15px/22px var(--gr-sans); color: var(--gr-texte-2); overflow-wrap: anywhere; }
.po-feuille .po-pieces { margin: 2px 0 0; font: 500 13px/18px var(--gr-sans); color: var(--gr-texte-2); overflow-wrap: anywhere; }
.po-feuille .po-existe { margin: 2px 0 0; font: 500 13px/18px var(--gr-sans); color: var(--gr-texte); overflow-wrap: anywhere; }
/* Le Dictionnaire de Wada (case « wada ») : la combinaison que forme la tenue, pastilles du livre côte à côte (--c1 posé
   par la page, liseré comme les pastilles du compositeur), lien vers la page Couleurs ; ou « aucune », discret. */
.po-feuille .po-wada-ligne { margin: 4px 0 0; }
.po-feuille .po-wada { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; font: 600 13px/18px var(--gr-sans);
    color: var(--gr-texte); text-decoration: underline; text-decoration-color: var(--gr-ligne-forte); text-underline-offset: 3px; overflow-wrap: anywhere; }
.po-feuille .po-wada:hover { text-decoration-color: currentColor; }
.po-feuille .po-wada-pastilles { display: inline-flex; flex: none; }
.po-feuille .po-wada-pastilles > i { display: block; width: 14px; height: 18px; background: var(--c1);
    --c-encre: color-mix(in oklab, var(--c1) 50%, var(--gr-texte)); box-shadow: inset 0 0 0 1px var(--c-encre); }
.po-feuille .po-wada-pastilles > i:first-child { border-radius: 4px 0 0 4px; }
.po-feuille .po-wada-pastilles > i:last-child { border-radius: 0 4px 4px 0; }
.po-feuille .po-wada-aucune { margin: 4px 0 0; font: 500 13px/18px var(--gr-sans); color: var(--gr-texte-2); }
.po-feuille .po-case-note { display: block; margin-top: 2px; color: var(--gr-texte); }
.po-feuille .po-case-note[hidden] { display: none; }
@media (forced-colors: active) {
    .po-feuille .po-wada-pastilles > i { forced-color-adjust: none; box-shadow: inset 0 0 0 1px CanvasText; }
}
.po-feuille .po-carte-erreur { display: flex; gap: 6px; align-items: flex-start; margin: 4px 0 0; font: 500 13px/18px var(--gr-sans); color: var(--gr-danger); overflow-wrap: anywhere; }
.po-feuille .po-carte-erreur > .g-ic { width: 16px; height: 16px; }
/* Les gestes d'une carte : « Garder » (secondaire petit) puis les liens texte ; ils passent à la ligne plutôt que de
   déborder. Un bouton texte collé au bord gauche : sa marge intérieure est rendue au texte. */
.po-feuille .po-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 8px; }
.po-feuille .po-actions > .g-bouton.secondaire.petit { margin-right: 4px; }
.po-feuille .po-actions > .g-bouton.texte.petit { padding: 0 8px; gap: 6px; }
.po-feuille .po-actions > .g-bouton.texte.petit:first-child, .po-feuille .po-gardee + .g-bouton.texte.petit { margin-left: -2px; }
.po-feuille .po-actions .g-ic { width: 18px; height: 18px; }
.po-feuille .po-gardee { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding-right: 2px; font: 600 15px/20px var(--gr-sans); color: var(--gr-texte-2); }
.po-feuille .po-gardee > .g-ic { color: var(--gr-texte); }

/* ---------------- Le pied ---------------- */
/* Un seul primaire, pleine largeur ; le bouton texte « Modifier la demande » au-dessus de lui (au bureau aussi : la
   feuille de 520 n'a pas la place des deux côte à côte avec le coût) ; un libellé trop long passe sur deux lignes, le
   montant d'un tenant. */
.po-feuille .g-feuille-pied { flex-direction: column; align-items: stretch; gap: 6px; }
.po-feuille .g-feuille-pied > .g-bouton { flex: 0 0 auto; }
.po-feuille .g-feuille-pied > .g-bouton.bas { height: auto; min-height: 52px; padding-top: 6px; padding-bottom: 6px; white-space: normal; text-align: center; line-height: 22px; }
.po-feuille .g-feuille-pied > .g-bouton.bas > span { min-width: 0; }
.po-feuille .po-pied-aide { margin: 0; font: 500 13px/18px var(--gr-sans); color: var(--gr-texte-2); text-align: center; overflow-wrap: anywhere; }
.po-feuille .po-pied-aide[hidden] { display: none; }

@media (min-width: 1024px) {
    .po-feuille .po-carte { grid-template-columns: 104px minmax(0, 1fr); column-gap: 16px; }
    .po-feuille .g-planche.po-planche, .po-feuille .po-sq-planche { width: 104px; }
}

/* ---------------- Le sélecteur « Choisir des pièces » ---------------- */
/* La barre (recherche, puces) reste collée en haut du corps qui défile ; elle en couvre le haut (fond de la feuille). */
.po-choix .po-ch { display: flex; flex-direction: column; min-width: 0; }
.po-choix .g-feuille-corps { padding-top: 0; }
.po-choix .po-ch-outils {
    position: sticky; top: 0; z-index: 2; display: flex; flex-direction: column; gap: 10px;
    padding: 4px 0 10px; background: var(--gr-surface);
}
/* La recherche, comme celle de Pièces : la pilule et sa croix « Effacer la recherche » (44 × 44, à droite, quand le champ a
   du texte) ; celle du navigateur est masquée. */
.po-choix .po-ch-cherche { position: relative; margin: 0 var(--gr-marge); }
.gr .po-choix .po-ch-cherche input { padding-right: 52px; }
.po-choix .po-ch-cherche input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.po-choix .po-ch-effacer { position: absolute; right: 4px; top: 4px; color: var(--gr-texte-2); }
.po-choix .po-ch-puces { padding: 4px 16px 4px var(--gr-marge); }
.po-choix .po-ch-liste { display: flex; flex-direction: column; min-width: 0; padding-bottom: 8px; }
.po-choix .po-ch-section + .po-ch-section { margin-top: 8px; }
.po-choix .po-ch-titre {
    display: flex; align-items: baseline; gap: 8px; margin: 16px var(--gr-marge) 12px; font: 600 15px/20px var(--gr-sans);
    overflow-wrap: anywhere; min-width: 0;
}
.po-choix .po-ch-nb { font: 500 13px/18px var(--gr-sans); color: var(--gr-texte-2); font-variant-numeric: tabular-nums; }
.po-choix .po-ch-trouvees { margin: 12px var(--gr-marge) 10px; font: 500 13px/18px var(--gr-sans); color: var(--gr-texte-2); }
.po-choix .po-ch-rien { margin: 20px var(--gr-marge); font: 500 15px/21px var(--gr-sans); color: var(--gr-texte-2); overflow-wrap: anywhere; }
/* La grille : des tuiles de 100 px au moins (3 colonnes de 105 px à 375, 4 dans la feuille de 520 du bureau), assez pour
   lire « Chaussettes Mazarin noires » en deux lignes (coupure française au besoin) et toucher d'une main ; la coche déborde
   de 6 px, l'écart et la marge l'accueillent. */
.po-choix .po-ch-grille {
    list-style: none; margin: 0 var(--gr-marge); padding: 6px 0 0; min-width: 0;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100px, 100%), 1fr)); gap: 16px 10px;
}
.po-choix .po-ch-tuile .g-cellule-nom { -webkit-hyphens: auto; hyphens: auto; }
.po-choix .po-ch-grille > li { min-width: 0; }
.po-choix .po-ch-tuile { -webkit-tap-highlight-color: transparent; }
/* Le pied : le compteur et la phrase discrète (remplacement, plafond), puis les deux gestes, côte à côte. */
.po-choix .g-feuille-pied { flex-direction: column; align-items: stretch; gap: 8px; }
.po-choix .po-ch-etat { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 0; text-align: center; min-width: 0; }
.po-choix .po-ch-compte { font: 600 13px/18px var(--gr-sans); color: var(--gr-texte); font-variant-numeric: tabular-nums; }
.po-choix .po-ch-note { font: 500 13px/18px var(--gr-sans); color: var(--gr-texte-2); overflow-wrap: anywhere; }
.po-choix .po-ch-note:empty { display: none; }
.po-choix .po-ch-gestes { display: flex; gap: 8px; }
.po-choix .po-ch-gestes > .g-bouton { flex: 1 1 0; min-width: 0; }
/* Au bureau : les puces passent à la ligne (une souris ne fait pas défiler de côté), comme dans Pièces. */
@media (min-width: 1024px) {
    .po-choix .po-ch-puces { flex-wrap: wrap; overflow: visible; padding: 0 var(--gr-marge-d) 0 var(--gr-marge); -webkit-mask: none; mask: none; }
}
