/* Écran : avenants au devis — création (gestion), détail, page de signature du client (/avenant/{jeton})
   et signature sur place (plein écran), section « Avenants » de la fiche RDV, escompte à l'encaissement.
   Réutiliser les tokens et composants de app.css / admin.css (ne jamais redéfinir de token).
   Liée par layouts/admin.php et layouts/public.php ; la page plein écran (layout bare) la charge elle-même. */

/* ---------- Statuts ---------- */
.badge--muted { background: var(--fill-2); color: var(--label-2); }
.amd-gift { color: var(--green); font-weight: 600; }
.amd-notice { margin: 0 0 var(--section-gap); }
.amd-notice a { font-weight: 600; }

/* ---------- Création (gestion) ---------- */
/* Client et RDV en tête (le sous-titre de la barre est masqué sous 1024 px) */
.amd-form__head { margin-bottom: var(--section-gap); }
.amd-op { position: relative; }
.amd-op + .amd-op, .amd-op + .amd-add { position: relative; }
.amd-op__head { padding-top: 6px; padding-bottom: 2px; min-height: 0; }
.amd-op__head .item__title { font: var(--t-headline); }
.amd-op__del { min-height: var(--hit); min-width: var(--hit); color: var(--red); padding: 0; }
.amd-op__del .icon { width: 20px; height: 20px; }
/* Rangées d'une modification : séparateurs inset comme le reste du groupe */
.amd-op > .frow { position: relative; }
.amd-op > .frow::before {
    content: ""; position: absolute; z-index: 1; top: 0; left: var(--sep-inset); right: 0;
    border-top: var(--hairline) solid var(--separator); pointer-events: none;
}
.amd-op__value .input { flex: 0 1 110px; max-width: 110px; text-align: right; }
.amd-op__value .seg { flex: none; }
.amd-op .frow > .select { flex: 1 1 auto; min-width: 0; max-width: 64%; margin-left: auto; text-overflow: ellipsis; text-align-last: right; }
.amd-add { gap: 8px; }
.amd-add .icon { width: 18px; height: 18px; }
.amd-errors { margin-top: 12px; }
.amd-actions { margin: 0 0 var(--header-gap); }
/* Aperçu pas encore valide : actions atténuées mais touchables (un toucher explique ce qui manque) */
.amd-actions--pending .btn:not([disabled]) { opacity: .5; }
.amd-actions__foot { margin-bottom: var(--section-gap); }

/* ---------- Page du client / signature sur place ---------- */
/* Page transactionnelle : un seul bouton plein, pas de « Réserver » dans l'en-tête */
body:has(.amd-page) .site-header .btn--brand { display: none; }
.amd-page .done-hero__check--due { background: var(--brand-tinted); color: var(--brand-text); }
.amd-page .done-hero__check--failed { background: var(--red-bg); color: var(--red); }
.amd-alert { margin: 0 0 var(--section-gap); }
.amd-total .item__title, .amd-total .item__value { font-weight: 600; color: var(--label); }
/* Pavé de signature (nom, tracé pivotable, nom tapé, horodatage) : composant commun screens/signature.css */
.amd-sign__error { margin: var(--header-gap) 16px 0; }
.amd-sign__actions, .amd-done__actions { margin: 0 0 var(--section-gap); }
.amd-refuse details.more > summary { color: var(--red); }
.amd-refuse form { display: block; }
.amd-refuse form .frow { position: relative; }
.amd-refuse form .frow::before, .amd-refuse form .item::before {
    content: ""; position: absolute; z-index: 1; top: 0; left: var(--sep-inset); right: 0;
    border-top: var(--hairline) solid var(--separator); pointer-events: none;
}
.amd-refuse form .item { position: relative; width: 100%; }
.amd-legal { text-align: center; margin: 0 16px 24px; }
.amd-page .group > details.more[open] > div { position: relative; }
.amd-page .group > details.more[open] > div::before {
    content: ""; position: absolute; z-index: 1; top: 0; left: var(--sep-inset); right: 0;
    border-top: var(--hairline) solid var(--separator); pointer-events: none;
}
/* Plein écran (appareil tendu au client) : pas d'en-tête, marges sûres */
.amd-page--onsite { padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: max(16px, env(safe-area-inset-bottom)); }
body.bare:has(.amd-page--onsite) { background: var(--bg); }
/* Barre du haut (sur place) : « Retour » / « Terminer » vers la gestion, comme une barre de navigation iOS */
.amd-onsite-bar { display: flex; margin: 0 -8px 4px; }
.amd-onsite-bar__back { gap: 2px; font: var(--t-body); }
.amd-onsite-bar__back .icon { width: 22px; height: 22px; margin-left: -4px; }

/* ---------- Fiche RDV : section « Avenants » ---------- */
.appt-amd .item__sub { -webkit-line-clamp: 1; line-clamp: 1; }
.appt-amd .badge { margin-left: 6px; vertical-align: 1px; }

/* ---------- Encaisser : escompte ---------- */
.pay-escompte .item__value { color: var(--label); font-weight: 600; }

/* ---------- Espace client : avenants sous le rendez-vous ---------- */
.account__past > .item + .item { position: relative; }
.account__past > .item + .item::before {
    content: ""; position: absolute; z-index: 1; top: 0; left: var(--sep-inset); right: 0;
    border-top: var(--hairline) solid var(--separator); pointer-events: none;
}
