/**
 * FICHE-PAIE.FR - Générateur de bulletins de paie
 *
 * @copyright 2025-2026 Purple Telecom EURL
 * @license   Proprietary - All Rights Reserved
 * @author    Équipe POLYGON
 * @link      https://fiche-paie.fr
 *
 * Modal Panier Multi-Bulletins - Styles CSS
 *
 * Lot 28 (18/10/2026) : panier refait selon la maquette validée
 * (/opt/polygon/docs/projets/FICHE_PAIE.fr/maquette-panier/panier_maquette_validee.html).
 *
 *   ordinateur (900 px et plus)          smartphone (575 px et moins)
 *   ┌───────────────────────────────┐    ┌──────────────────────┐
 *   │ en-tête (icône PDF, titre, ×) │    │ en-tête              │
 *   ├─────────────────┬─────────────┤    ├──────────────────────┤
 *   │ bandeau N       │ prix        │    │ bandeau, mois cochés │ ← défile
 *   │ mois cochés     │             │    │ + ajouter / grille   │
 *   │ + ajouter       │ cumuls      │    ├──────────────────────┤
 *   │   ou grille     │ Payer       │    │ prix                 │ ← fixe
 *   │                 │ crédits     │    │ cumuls, Payer,       │
 *   │                 │ Stripe      │    │ crédits, Stripe      │
 *   └─────────────────┴─────────────┘    └──────────────────────┘
 *   entre 576 et 899 px : même colonne que le smartphone, fenêtre centrée.
 *
 * Aucun débordement horizontal : chaque bloc flexible a min-width: 0, les
 * noms longs sont coupés par des points de suspension, la fenêtre ne dépasse
 * jamais la partie visible de l'écran. Cause du débordement d'avant le lot :
 * sur iPhone, Safari agrandit la page quand le client touche un champ du
 * formulaire (police de moins de 16 px) ; le panier, fixé sur la page non
 * agrandie, sortait de l'écran à droite et en bas. Le panier se pose
 * désormais sur la partie visible (cart-modal.js, cartSuivreEcranVisible).
 */

/* =====================================================
   VARIABLES COULEURS - CART MODAL (valeurs de la maquette validée)
   ===================================================== */
:root {
    --cart-primary: #1d458c;
    --cart-primary-hover: #163a75;
    --cart-text: #1d2a44;
    --cart-text-muted: #5a6478;
    --cart-pale: #eef2f9;
    --cart-border: #e1e6ef;
    --cart-border-case: #b8c2d6;
    --cart-bg: #ffffff;
    --cart-bg-light: #fafbfd;
    --cart-bg-selected: #f7f9fd;
    --cart-vert: #1f7a5a;
    --cart-vert-fond: #eaf6f0;
    --cart-vert-bord: #bfe3d2;
    --cart-vert-titre: #14583f;
    --cart-vert-texte: #2f5e4c;
    --cart-orange-1: var(--gp-orange-clair, #fbb03b);
    --cart-orange-2: var(--gp-orange, #f7931e);
    --cart-error: var(--gp-error, #ef4444);
    --cart-shadow: rgba(20, 32, 60, 0.18);
    --cart-overlay: rgba(30, 55, 96, 0.6);
}

/* =====================================================
   OVERLAY
   ===================================================== */
.cart-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--cart-overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: var(--z-modal, 500);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow: hidden;
}

.cart-modal-overlay.active {
    display: flex;
    opacity: 1;
}

/* =====================================================
   FENÊTRE
   ===================================================== */
.cart-modal {
    box-sizing: border-box;
    background: var(--cart-bg);
    color: var(--cart-text);
    border-radius: 16px;
    box-shadow: 0 24px 60px var(--cart-shadow);
    width: 820px;
    max-width: 100%;
    /* 100 % : jamais plus haut que la partie visible (page agrandie, voir
       cartSuivreEcranVisible() dans cart-modal.js) */
    max-height: min(90vh, 100%);
    max-height: min(90dvh, 100%);
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.cart-modal *,
.cart-modal *::before,
.cart-modal *::after {
    box-sizing: border-box;
}

.cart-modal-overlay.active .cart-modal {
    transform: translateY(0);
}

/* Définition du dégradé de l'étiquette « PDF » : sans place ni rendu */
.cart-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* Texte lu par les lecteurs d'écran seulement */
.cart-lecteur {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* =====================================================
   EN-TÊTE
   ===================================================== */
.cart-modal-header {
    flex: none;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--cart-border);
    min-width: 0;
}

.cart-modal-header-icon {
    flex: none;
    width: 34px;
    height: 42px;
}

.cart-modal-header-icon .cart-pdf {
    width: 34px;
    height: 42px;
}

.cart-modal-header-text {
    flex: 1;
    min-width: 0;
}

.cart-modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--cart-text);
    margin: 0;
}

.cart-modal-header p {
    font-size: 13px;
    line-height: 1.35;
    color: var(--cart-text-muted);
    margin: 0;
}

.cart-modal-close {
    flex: none;
    margin-left: auto;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cart-text-muted);
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.cart-modal-close svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2.2;
    fill: none;
    stroke-linecap: round;
}

.cart-modal-close:hover {
    background: var(--cart-pale);
    color: var(--cart-text);
}

/* =====================================================
   CORPS : sélection (gauche) et paiement (droite)
   ===================================================== */
.cart-modal-corps {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    display: flex;
    flex-direction: row;
}

.cart-modal-body {
    flex: 1.4 1 0;
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding-bottom: 12px;
    border-right: 1px solid var(--cart-border);
    scrollbar-width: thin;
    scrollbar-color: var(--cart-border-case) transparent;
}

.cart-modal-droite {
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--cart-bg-light);
}

/* =====================================================
   BANDEAU DE SÉLECTION
   ===================================================== */
.cart-selection {
    margin: 12px 18px 0;
    background: var(--cart-pale);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.cart-selection[hidden] {
    display: none;
}

.cart-compteur {
    flex: none;
    min-width: 34px;
    height: 34px;
    padding: 0 6px;
    border-radius: 17px;
    background: var(--cart-primary);
    color: #ffffff;
    font-weight: 700;
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-selection-titre {
    margin: 0;
    min-width: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--cart-text);
}

/* =====================================================
   LISTE DES MOIS COCHÉS
   ===================================================== */
.cart-bulletin-list {
    padding: 10px 18px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.cart-bulletin-list:empty {
    padding-top: 0;
}

.cart-vide {
    margin: 0;
    text-align: center;
    color: var(--cart-text-muted);
}

.cart-bulletin-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    border: 1.5px solid var(--cart-border);
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--cart-bg);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.cart-bulletin-item.selected {
    border-color: var(--cart-primary);
    background: var(--cart-bg-selected);
}

.cart-bulletin-item.locked {
    cursor: default;
}

/* Case cochée */
.cart-case {
    flex: none;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 6px;
    border: 2px solid var(--cart-border-case);
    background: var(--cart-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.cart-bulletin-item.selected .cart-case {
    background: var(--cart-primary);
    border-color: var(--cart-primary);
}

.cart-bulletin-item.locked .cart-case {
    cursor: default;
}

.cart-case svg {
    width: 14px;
    height: 14px;
    stroke: #ffffff;
    stroke-width: 3;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Icône PDF de la ligne */
.cart-bulletin-item .cart-pdf {
    flex: none;
    width: 30px;
    height: 38px;
}

.cart-item-infos {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.cart-bulletin-period {
    display: block;
    font-size: 15.5px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--cart-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-bulletin-details {
    display: block;
    position: relative;
    min-height: 17px;
    font-size: 12.5px;
    line-height: 1.35;
    color: var(--cart-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* « Modifier » */
.cart-btn-edit {
    flex: none;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--cart-primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.cart-btn-edit:hover {
    background: var(--cart-pale);
}

.cart-btn-edit svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* =====================================================
   AJOUTER OU CHOISIR DES MOIS, GRILLE DES MOIS
   ===================================================== */
.cart-ajout-zone {
    padding: 8px 18px 0;
    min-width: 0;
}

.cart-ajout-zone:empty {
    display: none;
}

.cart-ajout {
    width: 100%;
    min-width: 0;
    margin: 2px 0 4px;
    border: 2px dashed var(--cart-border-case);
    border-radius: 12px;
    padding: 11px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--cart-bg);
    color: var(--cart-primary);
    font-family: inherit;
    font-weight: 700;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.cart-ajout:hover {
    border-color: var(--cart-primary);
    background: var(--cart-bg-selected);
}

.cart-ajout-plus {
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--cart-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
}

.cart-ajout-texte {
    min-width: 0;
}

.cart-ajout-texte small {
    display: block;
    font-weight: 400;
    font-size: 12.5px;
    color: var(--cart-text-muted);
}

.cart-grille {
    margin: 2px 0 4px;
    border: 1.5px solid var(--cart-primary);
    border-radius: 12px;
    padding: 10px;
    background: var(--cart-bg);
    min-width: 0;
}

.cart-grille-tete {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin: 0 2px 8px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--cart-text);
    min-width: 0;
}

.cart-grille-fin {
    flex: none;
    border: 0;
    border-radius: 8px;
    padding: 6px 12px;
    background: var(--cart-primary);
    color: #ffffff;
    font-family: inherit;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}

.cart-puces {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.cart-puce {
    min-width: 0;
    border: 1.5px solid var(--cart-border-case);
    border-radius: 9px;
    padding: 7px 2px;
    background: var(--cart-bg);
    color: var(--cart-text);
    font-family: inherit;
    font-size: 12.5px;
    line-height: 1.15;
    text-align: center;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-puce small {
    display: block;
    font-size: 10.5px;
    color: var(--cart-text-muted);
}

.cart-puce.on {
    background: var(--cart-primary);
    border-color: var(--cart-primary);
    color: #ffffff;
}

.cart-puce.on small {
    color: #dbe4f5;
}

.cart-puce.locked {
    cursor: default;
}

.cart-case:focus-visible,
.cart-btn-edit:focus-visible,
.cart-ajout:focus-visible,
.cart-puce:focus-visible,
.cart-grille-fin:focus-visible,
.cart-btn-pay:focus-visible,
.cart-btn-credits:focus-visible,
.cart-modal-close:focus-visible {
    outline: 3px solid var(--cart-orange-1);
    outline-offset: 2px;
}

/* =====================================================
   PRIX (HT uniquement)
   ===================================================== */
.cart-summary {
    position: relative;
    padding: 12px 18px 6px;
    background: var(--cart-bg-light);
    min-width: 0;
}

.cart-summary:empty {
    display: none;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--cart-text-muted);
    min-width: 0;
}

.cart-summary-label {
    flex: 1;
    min-width: 0;
}

.cart-summary-value {
    flex: none;
    white-space: nowrap;
}

.cart-summary-row.discount {
    color: var(--cart-vert);
}

.cart-summary-row.total {
    align-items: baseline;
    border-top: 1.5px solid var(--cart-text);
    padding-top: 8px;
    margin: 4px 0 0;
    color: var(--cart-text);
}

.cart-summary-row.total .cart-summary-label {
    font-size: 16px;
    font-weight: 700;
}

.cart-summary-row.total .cart-summary-value {
    font-size: 24px;
    font-weight: 700;
}

.cart-summary-erreur {
    color: var(--cart-error);
}

.cart-summary-unite {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--cart-text-muted);
    text-align: right;
}

/* Indicateur winback (offre personnelle -30 %) — message non bloquant */
.cart-summary-row.winback-hint {
    font-size: 0.8125rem;
    color: #b45309;
    background: #fef3c7;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    margin-top: 0.5rem;
}

.cart-summary-row.winback-hint.eligible {
    color: #0f766e;
    background: #eef6f7;
}

/* Mise en avant de la remise winback (offre personnelle -30 %) — bloc sobre,
   fond teal/accent léger, sans emoji. Affiché uniquement quand l'API panier
   renvoie les montants (contexte winback validé + panier >= 3 bulletins). */
.cart-winback-summary {
    margin-top: 0.625rem;
    padding: 0.75rem 0.875rem;
    background: rgba(94, 197, 200, 0.10);
    border: 1px solid rgba(94, 197, 200, 0.35);
    border-radius: 8px;
}

.cart-winback-summary .cart-summary-row {
    padding: 0.25rem 0;
    margin-bottom: 0;
}

.cart-winback-summary .cart-winback-offer,
.cart-winback-summary .cart-winback-offer .cart-summary-value {
    color: #0f766e;
    font-weight: 600;
}

.cart-winback-summary .cart-winback-total {
    padding-top: 0.5rem;
    margin-top: 0.25rem;
    border-top: 1px solid rgba(94, 197, 200, 0.35);
    font-size: 1.0625rem;
    font-weight: 700;
    color: #0f766e;
}

.cart-winback-summary .cart-winback-total .cart-summary-value {
    color: #0f766e;
    font-size: 1.1875rem;
    font-weight: 700;
}

/* Mention discrète de la TVA (calculée par Stripe au paiement) */
.cart-winback-tva {
    margin: 0.375rem 0 0;
    font-size: 0.75rem;
    color: var(--cart-text-muted);
    text-align: right;
}

/* =====================================================
   PIED : CUMULS CONTRÔLÉS, PAYER, CRÉDITS, STRIPE
   ===================================================== */
.cart-modal-footer {
    padding: 10px 18px 16px;
    background: var(--cart-bg-light);
    min-width: 0;
}

/* Encadré vert « Cumuls contrôlés sur vos N bulletins » (dès 2 bulletins) */
.cart-coherence-section {
    margin: 0 0 10px;
    display: flex;
    gap: 11px;
    align-items: flex-start;
    background: var(--cart-vert-fond);
    border: 1px solid var(--cart-vert-bord);
    border-radius: 12px;
    padding: 10px 12px;
    min-width: 0;
}

.cart-coherence-section[hidden] {
    display: none;
}

.cart-coherence-section svg {
    flex: none;
    width: 26px;
    height: 26px;
}

.cart-coherence-section > div {
    min-width: 0;
}

.cart-coherence-section b {
    display: block;
    font-size: 14px;
    color: var(--cart-vert-titre);
}

.cart-coherence-section span {
    display: block;
    font-size: 12.5px;
    line-height: 1.35;
    color: var(--cart-vert-texte);
}

/* « Payer X € HT », nombre de bulletins en dessous */
.cart-btn-pay {
    width: 100%;
    border: 0;
    border-radius: 12px;
    padding: 14px;
    background: linear-gradient(135deg, var(--cart-orange-1), var(--cart-orange-2));
    color: #ffffff;
    font-family: inherit;
    font-size: 16.5px;
    font-weight: 700;
    line-height: 1.25;
    box-shadow: 0 6px 14px rgba(247, 147, 30, 0.3);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: filter 0.2s, opacity 0.2s;
}

.cart-btn-pay small {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    opacity: 0.95;
    margin-top: 2px;
}

.cart-btn-pay:hover:not(:disabled) {
    filter: brightness(1.04);
}

.cart-btn-pay:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Option « Utiliser mes crédits » (au moins 1 crédit) */
.cart-credits-option {
    margin-top: 10px;
}

.cart-credits-option[hidden] {
    display: none;
}

/* Séparateur « ou » entre « Payer » et l'option crédits */
.cart-credits-separator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0 8px;
    color: var(--cart-text-muted);
    font-size: 12px;
}

.cart-credits-separator::before,
.cart-credits-separator::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--cart-border);
}

.cart-btn-credits {
    width: 100%;
    border: 1.5px solid var(--cart-primary);
    border-radius: 12px;
    padding: 11px;
    background: var(--cart-bg);
    color: var(--cart-primary);
    font-family: inherit;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.2s;
}

.cart-btn-credits:hover:not(:disabled) {
    background: var(--cart-bg-selected);
}

.cart-btn-credits:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Crédits insuffisants : « Il vous manque X crédit(s) » + lien rachat */
.cart-credits-missing {
    margin: 6px 0 0;
    font-size: 12.5px;
    color: var(--cart-text-muted);
    text-align: center;
}

.cart-credits-missing a {
    color: var(--cart-primary);
    text-decoration: underline;
}

/* Lot 80 : document coché, crédits inutilisables (règle écrite sous le bouton) */
.cart-credits-documents {
    margin: 6px 0 0;
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--cart-text-muted);
    text-align: center;
}

/* Lot 81 (complément n°3) : paiement mixte, document coché avec « Utiliser
   mes crédits » : résumé en deux parties (bulletins en crédits, documents
   par carte) au-dessus du bouton « Payer X € HT par carte » sur deux lignes */
.cart-credits-mixte {
    margin: 0 0 8px;
}

.cart-btn-credits small {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    opacity: 0.85;
}

.cart-btn-credits:has(small) {
    flex-direction: column;
    gap: 2px;
}

/* =====================================================
   LOT 80 : SERVICES ADDITIONNELS (maquette Panier.dc.html)
   Certificat et attestation de travail sous la liste des mois : case,
   nom, texte, prix HT ; carte bordée de bleu quand elle est cochée.
   ===================================================== */
.cart-services {
    margin: 10px 18px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.cart-services[hidden] {
    display: none;
}

.cart-services-titre {
    margin: 4px 0 2px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--cart-primary);
}

.cart-services-liste {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.cart-service {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
    border: 1.5px solid var(--cart-border);
    border-radius: 12px;
    padding: 12px;
    background: var(--cart-bg);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.cart-service.is-choisi {
    border-color: var(--cart-primary);
    background: var(--cart-bg-selected);
}

.cart-service-case {
    flex: none;
    width: 22px;
    height: 22px;
    margin: 1px 0 0;
    accent-color: var(--cart-primary);
    cursor: pointer;
}

.cart-service-case:focus-visible {
    outline: 2px solid var(--cart-primary);
    outline-offset: 2px;
}

.cart-service-texte {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cart-service-nom {
    font-size: 15.5px;
    font-weight: 700;
    color: var(--cart-text);
}

.cart-service-aide {
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--cart-text-muted);
}

.cart-service-prix {
    flex: none;
    font-size: 15px;
    font-weight: 700;
    color: var(--cart-text);
    white-space: nowrap;
}

/* Règle des crédits sous la mention de paiement sécurisé */
.cart-regle-credits {
    margin: 6px 0 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--cart-text-muted);
    text-align: center;
}

.cart-regle-credits[hidden] {
    display: none;
}

@media (max-width: 374px) {
    .cart-service {
        flex-wrap: wrap;
    }

    .cart-service-prix {
        margin-left: 34px;
    }
}

/* Mention « Paiement sécurisé par Stripe » */
.cart-security-notice {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 12px;
    color: var(--cart-text-muted);
    text-align: center;
}

.cart-security-notice svg {
    flex: none;
    width: 12px;
    height: 12px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* =====================================================
   ATTENTE : SPINNER ORANGE DU LOT 27
   Dessin de l'anneau : classe fp-attente-spinner (pages/generate.css, même
   page). Zone invisible les 300 premières millisecondes (classe
   cart-attente-visible posée par cart-modal.js), puis spinner animé.
   ===================================================== */
.cart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    padding: 2rem;
}

.cart-attente {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
}

.cart-attente.cart-attente-visible {
    opacity: 1;
}

.cart-attente-visible .fp-attente-spinner {
    animation: fp-attente-tourne 0.8s linear infinite;
}

/* Ligne d'un mois : petit spinner à la place du net */
.cart-bulletin-details .cart-attente-petit .fp-attente-spinner-petit {
    width: 16px;
    height: 16px;
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
}

/* Prix : spinner posé sur le prix précédent, pâli, sans changer la hauteur */
.cart-attente-surcouche {
    position: absolute;
    inset: 0;
    display: flex;
}

.cart-attente-surcouche.cart-attente-visible {
    background: rgba(250, 251, 253, 0.75);
}

.cart-attente-surcouche:only-child {
    position: static;
    min-height: 64px;
    width: 100%;
}

@media (prefers-reduced-motion: reduce) {
    .cart-attente-visible .fp-attente-spinner {
        animation-duration: 2.4s;
    }
}

/* Échec du chargement du panier : message coupé à la largeur du panier */
.cart-erreur {
    padding: 2rem 18px;
    text-align: center;
    color: var(--cart-error);
    overflow-wrap: anywhere;
}

.cart-erreur p {
    margin: 0 0 0.5rem;
}

.cart-erreur-detail {
    font-size: 0.875rem;
    color: var(--cart-text-muted);
}

/* Petit anneau des boutons pendant un paiement (« Traitement... ») */
.cart-spinner {
    display: inline-block;
    flex: none;
    width: 32px;
    height: 32px;
    border: 3px solid var(--cart-border);
    border-top-color: var(--cart-primary);
    border-radius: 50%;
    animation: cart-spin 0.8s linear infinite;
}

.cart-spinner.cart-spinner-bouton {
    width: 18px;
    height: 18px;
    border-width: 2px;
}

@keyframes cart-spin {
    to {
        transform: rotate(360deg);
    }
}

/* =====================================================
   ENTRE 576 ET 899 PX : UNE COLONNE, FENÊTRE CENTRÉE
   ===================================================== */
@media (max-width: 899px) {
    .cart-modal {
        width: 560px;
    }

    .cart-modal-corps {
        flex-direction: column;
    }

    /* La sélection défile ; le prix et « Payer » restent toujours visibles en bas */
    .cart-modal-body {
        flex: 1 1 auto;
        border-right: 0;
        padding-bottom: 8px;
    }

    .cart-modal-droite {
        flex: none;
        overflow: visible;
        justify-content: flex-start;
        border-top: 1px solid var(--cart-border);
    }
}

/* Écran trop bas pour garder le prix et « Payer » fixes (smartphone à
   l'horizontale, ou page agrandie : classe cart-ecran-court posée par
   cart-modal.js) : toute la fenêtre défile */
@media (max-width: 899px) and (max-height: 560px) {
    .cart-modal {
        overflow-y: auto;
    }

    .cart-modal-corps,
    .cart-modal-body {
        flex: none;
        min-height: auto;
        overflow: visible;
    }
}

.cart-modal-overlay.cart-ecran-court .cart-modal {
    overflow-y: auto;
}

.cart-modal-overlay.cart-ecran-court .cart-modal-corps,
.cart-modal-overlay.cart-ecran-court .cart-modal-body {
    flex: none;
    min-height: auto;
    overflow: visible;
}

/* =====================================================
   SMARTPHONE (575 PX ET MOINS) : FENÊTRE EN BAS DE L'ÉCRAN
   ===================================================== */
@media (max-width: 575px) {
    .cart-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .cart-modal {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 18px 18px 0 0;
        max-height: min(94vh, 100%);
        max-height: min(94dvh, 100%);
    }
}

/* Très petits écrans (360 px) : marges intérieures réduites */
@media (max-width: 374px) {
    .cart-modal-header,
    .cart-summary,
    .cart-modal-footer {
        padding-left: 14px;
        padding-right: 14px;
    }

    .cart-selection {
        margin-left: 14px;
        margin-right: 14px;
    }

    .cart-bulletin-list,
    .cart-ajout-zone {
        padding-left: 14px;
        padding-right: 14px;
    }

    .cart-bulletin-item {
        gap: 8px;
        padding: 10px;
    }
}

/* =====================================================
   ANIMATIONS
   ===================================================== */
@keyframes cart-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes cart-slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.cart-modal-overlay.active {
    animation: cart-fadeIn 0.25s ease;
}

.cart-modal-overlay.active .cart-modal {
    animation: cart-slideUp 0.3s ease;
}

/* =====================================================
   LOT 30 (18/10/2026, audits 26 et 27)
   Placé en fin de feuille : ces règles complètent celles du lot 28 et
   l'emportent à spécificité égale.
   ===================================================== */

/* A6-15 : la fenêtre reçoit le focus à l'ouverture (tabindex="-1"), sans anneau */
.cart-modal:focus {
    outline: none;
}

/* S2-15 : seule la case décoche ; la ligne elle-même n'est plus cliquable */
.cart-bulletin-item {
    cursor: default;
}

.cart-case {
    cursor: pointer;
}

/* Ajout 1 : « Paiement sécurisé par Stripe » et « Téléchargement PDF
   instantané » côte à côte, l'un sous l'autre quand la largeur manque */
.cart-security-notice {
    flex-wrap: wrap;
    gap: 5px 14px;
}

.cart-notice-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

/* S2-08 : échec du calcul enchaîné sur une ligne : « Montants non recalculés »
   et bouton « Réessayer » (texte, bleu) ; la ligne peut passer sur deux lignes */
.cart-bulletin-details.cart-details-echec {
    white-space: normal;
}

.cart-non-recalcule {
    color: #b45309;
}

.cart-btn-reessayer {
    border: 0;
    background: transparent;
    padding: 2px 6px;
    min-height: 32px;
    color: var(--cart-primary);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    vertical-align: middle;
}

/* S2-03, S2-10, A2-04 : message d'état du panier (#cartMessageEtat), sous le
   bandeau de sélection ; trois causes : reset (information), expire et jeton
   (avertissement) ; lien « Annuler », bouton « Recharger » */
.cart-message {
    margin: 12px 18px 0;
    border-radius: 12px;
    border: 1px solid var(--cart-border);
    background: var(--cart-pale);
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--cart-text);
    min-width: 0;
    overflow-wrap: anywhere;
}

.cart-message[hidden] {
    display: none;
}

.cart-message[data-cause="expire"],
.cart-message[data-cause="jeton"] {
    background: #fef3c7;
    border-color: #f5d78e;
    color: #7c3a0b;
}

.cart-message-texte {
    margin: 0;
}

.cart-message-actions {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
}

.cart-message-lien {
    border: 0;
    background: transparent;
    padding: 0;
    color: var(--cart-primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

.cart-message-bouton {
    border: 1.5px solid var(--cart-primary);
    border-radius: 8px;
    padding: 6px 12px;
    background: var(--cart-bg);
    color: var(--cart-primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.cart-btn-reessayer:focus-visible,
.cart-message-lien:focus-visible,
.cart-message-bouton:focus-visible {
    outline: 3px solid var(--cart-orange-1);
    outline-offset: 2px;
}

/* S2-15 : écran tactile (toute largeur, tablette comprise) : cibles de
   44 px (jeton --touch-target-min). La case garde son carré dessiné de
   24 px dans une zone de toucher de 44 px ; « Modifier » (14 px) et la croix
   reçoivent aussi 44 px de zone de toucher. Ces zones débordent sur les
   marges intérieures de la ligne et de l'en-tête (marges négatives) : la
   ligne garde sa hauteur du lot 28 et « 3 mois visibles sans défiler » à
   360 × 780 est préservé ; puces, « Terminé » et « Réessayer » à 44 px.
   Sur pointeur fin, le lot 28 est inchangé. */
@media (pointer: coarse) {
    .cart-case {
        position: relative;
        width: var(--touch-target-min, 44px);
        height: var(--touch-target-min, 44px);
        margin: -10px;
        border: 0;
        background: transparent;
    }

    .cart-case::before {
        content: "";
        position: absolute;
        left: 50%;
        top: 50%;
        width: 24px;
        height: 24px;
        margin: -12px 0 0 -12px;
        border-radius: 6px;
        border: 2px solid var(--cart-border-case);
        background: var(--cart-bg);
    }

    .cart-bulletin-item.selected .cart-case {
        background: transparent;
        border-color: transparent;
    }

    .cart-bulletin-item.selected .cart-case::before {
        background: var(--cart-primary);
        border-color: var(--cart-primary);
    }

    .cart-case svg {
        position: relative;
    }

    .cart-btn-edit {
        min-height: var(--touch-target-min, 44px);
        padding: 10px 8px;
        margin: -6px -4px -6px 0;
        font-size: 14px;
    }

    .cart-puce {
        min-height: var(--touch-target-min, 44px);
    }

    .cart-grille-fin {
        min-height: var(--touch-target-min, 44px);
    }

    .cart-modal-close {
        width: var(--touch-target-min, 44px);
        height: var(--touch-target-min, 44px);
        margin: -6px -6px -6px auto;
    }

    .cart-btn-reessayer,
    .cart-message-bouton {
        min-height: var(--touch-target-min, 44px);
    }
}

/* S2-12, A3-07 : smartphone : marge de sécurité sous « Payer » et la mention
   Stripe (barre du navigateur ou encoche en bas de l'écran) */
@media (max-width: 575px) {
    .cart-modal-footer {
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }
}

/* Très petits écrans : le message d'état suit les marges réduites du lot 28 ;
   la mention Stripe passe sur deux lignes (ajout 1) : interligne et marge
   resserrés pour que les trois mois précochés restent visibles sans défiler */
@media (max-width: 374px) {
    .cart-message {
        margin-left: 14px;
        margin-right: 14px;
    }

    .cart-security-notice {
        margin-top: 6px;
        line-height: 1.2;
        gap: 3px 12px;
    }
}

/* =====================================================
   LOT 86 : OPTIONS PAYANTES DU BULLETIN
   Sous chaque mois, une ligne par option que sa saisie utilise, avec son
   prix unitaire HT lu chez Stripe (rien n'est décochable : l'option découle
   de la saisie) ; ligne « Options » du résumé ; refus ou attente.
   ===================================================== */
.cart-options-mois {
    list-style: none;
    margin: 6px 0 0;
    padding: 6px 0 0;
    border-top: 1px dashed var(--cart-border);
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cart-options-mois[hidden] {
    display: none;
}

.cart-options-mois li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--cart-text-muted);
}

.cart-option-nom {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.cart-option-prix {
    flex: none;
    white-space: nowrap;
    color: var(--cart-text);
    font-weight: 600;
}

.cart-summary-options .cart-summary-label {
    overflow-wrap: anywhere;
}

.cart-options-erreur {
    align-items: center;
    color: var(--cart-error);
}

.cart-options-erreur .cart-btn-reessayer {
    flex: none;
}

.cart-options-attente {
    font-style: italic;
}

/* =====================================================
   LOT 88 : LIGNES D'OPTION SUR TOUTE LA LARGEUR DE LA CARTE
   La liste des options d'un mois suit « Modifier » dans la carte
   (cart-modal.js) : la carte passe à la ligne et la liste occupe toute sa
   largeur intérieure, de la case jusqu'au bord droit, sous un filet discret.
   Libellé à gauche, prix à droite sur la première ligne du libellé. Sans
   option, la liste est masquée ([hidden], lot 86) : ni filet ni espace.
   La case et « Modifier » gardent leur taille et leur zone cliquable
   (lot 30, S2-15).
   ===================================================== */
.cart-bulletin-item {
    flex-wrap: wrap;
    row-gap: 0;
}

.cart-bulletin-item > .cart-options-mois {
    flex: 0 0 100%;
    width: 100%;
    margin: 8px 0 0;
    padding: 6px 0 0;
    border-top: 1px solid var(--cart-border);
    gap: 3px;
}

.cart-bulletin-item > .cart-options-mois li {
    gap: 12px;
}

.cart-bulletin-item > .cart-options-mois .cart-option-nom {
    overflow-wrap: break-word;
}

/* =====================================================
   LOT 90 : SUPPLÉMENT « HAUTE RÉMUNÉRATION »
   Ligne du supplément dans la liste des options du mois (même largeur et
   même filet, lot 88) : « Supplément : haute rémunération » et son prix,
   puis la précision « salaire brut au-delà du plafond mensuel de la
   Sécurité sociale », plus petite, sous le libellé (jamais sous le prix).
   ===================================================== */
.cart-option-supplement .cart-option-nom {
    display: block;
}

.cart-option-precision {
    display: block;
    margin-top: 1px;
    font-size: 11.5px;
    line-height: 1.35;
    color: var(--cart-text-muted);
    overflow-wrap: break-word;
}
