/* ================================================================
   SAMA NAFAA - Charte graphique commune à tous les écrans
   Pour changer l'identité visuelle, modifiez les valeurs ci-dessous.
   ================================================================ */

/* :root = l'endroit où on définit nos "variables" de couleur.
   Une variable = une couleur nommée qu'on réutilise partout.
   Changez la valeur ici → toute l'app change. */
:root {
    --bleu:        #14324F;  /* bleu marine profond : fonds, boutons principaux */
    --bleu-clair:  #1F4E79;  /* bleu un peu plus clair : titres */
    --orange:      #E8641C;  /* orange chaud : accents, actions importantes */
    --orange-doux: #F2A03D;  /* orange clair : le motif tissé */
    --creme:       #FBF7F1;  /* crème : fond des cartes */
    --brun:        #5A4634;  /* brun doux : texte des étiquettes */
    --brun-clair:  #8A6A4A;  /* brun clair : textes secondaires */
    --bordure:     #EAD9C4;  /* beige : bordure des champs */
}

/* Remise à zéro : enlève les marges/paddings par défaut du navigateur
   pour que tout soit cohérent. * = "tous les éléments". */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box; /* la largeur inclut la bordure : plus prévisible */
}

/* Le corps de la page : police + fond bleu marine */
body {
    font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bleu);       /* var(--bleu) = "utilise la variable bleu" */
    min-height: 100vh;             /* occupe au moins toute la hauteur de l'écran */
    display: flex;                 /* centre le contenu... */
    align-items: center;           /* ...verticalement */
    justify-content: center;       /* ...horizontalement */
    padding: 20px;
}

/* Le bandeau tissé décoratif, en haut de l'écran */
.bandeau {
    position: fixed;               /* collé en haut */
    top: 0; left: 0; right: 0;
    height: 14px;
    /* motif rayé en diagonale : orange, orange doux, bleu clair qui se répètent */
    background: repeating-linear-gradient(135deg,
        var(--orange)      0 14px,
        var(--orange-doux) 14px 28px,
        var(--bleu-clair)  28px 42px);
}

/* La carte blanche centrale qui contient le formulaire */
.carte {
    width: 100%;
    max-width: 340px;              /* ne dépasse jamais 340px, même sur grand écran */
    background: var(--creme);
    border-radius: 20px;           /* coins bien arrondis */
    padding: 30px 26px;
    box-shadow: 0 12px 40px rgba(0,0,0,.35); /* ombre douce pour le relief */
}

/* Le logo rond orange en haut de la carte */
.logo {
    width: 70px; height: 70px;
    margin: 0 auto 14px;           /* centré horizontalement */
    background: var(--orange);
    border-radius: 50%;            /* 50% = cercle parfait */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    box-shadow: 0 4px 14px rgba(232,100,28,.4);
}

/* Le nom "Sama Nafaa" */
.titre {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    color: var(--bleu);
}

/* Le petit slogan sous le titre, entouré de deux tirets orange */
.slogan {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 13px;
    color: var(--brun-clair);
}
.slogan span.tiret {
    width: 20px; height: 3px;
    background: var(--orange);
    border-radius: 2px;
}

/* Les étiquettes au-dessus des champs (ex : "Mon numéro") */
label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--brun);
    margin: 18px 0 6px;
}

/* Les champs de saisie (numéro, code...) */
input {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    color: #3A2E22;
    background: #FFF;
    border: 1.5px solid var(--bordure);
    border-radius: 12px;
    outline: none;                 /* enlève le contour bleu moche du navigateur */
}
/* Quand on clique dedans (focus), la bordure devient orange */
input:focus {
    border-color: var(--orange);
}

/* Le gros bouton principal */
button {
    width: 100%;
    margin-top: 24px;
    padding: 15px;
    font-size: 17px;
    font-weight: 600;
    color: #FFF;
    background: var(--bleu);
    border: none;
    border-radius: 12px;
    cursor: pointer;               /* la souris devient une main au survol */
    transition: background .2s;    /* animation douce du changement de couleur */
}
button:hover {
    background: var(--bleu-clair);  /* au survol, léger éclaircissement */
}

/* Le lien discret en bas ("Créer ma boutique") */
.lien {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--brun-clair);
}
.lien a {
    color: var(--orange);
    font-weight: 600;
    text-decoration: none;         /* pas de soulignement */
}

/* Zone d'affichage des erreurs (numéro/code incorrect) */
.erreur {
    background: #FDECEA;
    border: 1px solid #F5B7B1;
    color: #922B21;
    font-size: 14px;
    padding: 12px;
    border-radius: 10px;
    margin-top: 16px;
    text-align: center;
}
/* ================================================================
   TABLEAU DE BORD - styles spécifiques
   ================================================================ */

/* Le body du tableau de bord ne doit PAS centrer comme les formulaires :
   on utilise une classe pour l'aligner en haut. */
body.tableau {
    display: block;                /* annule le centrage flex */
    background: #F0F2F5;           /* fond clair pour l'espace de travail */
    padding: 0;
}

/* La barre bleue du haut avec le nom de la boutique */
.barre {
    background: var(--bleu);
    color: #fff;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.barre .nom {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 19px;
    font-weight: 600;
}
/* Le bouton "Quitter" dans la barre */
.barre .quitter {
    background: transparent;
    border: 1.5px solid rgba(255,255,255,.5);
    color: #fff;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 14px;
    width: auto;                   /* pas pleine largeur, contrairement aux autres boutons */
    margin: 0;
    cursor: pointer;
}
.barre .quitter:hover {
    background: rgba(255,255,255,.15);
}

/* La zone de contenu sous la barre */
.contenu {
    max-width: 500px;
    margin: 0 auto;
    padding: 24px;
}

/* La carte de bienvenue */
.bienvenue {
    background: #fff;
    padding: 28px 24px;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,.06);
    text-align: center;
}
.bienvenue h2 {
    color: var(--bleu);
    margin-bottom: 8px;
}
.bienvenue .a-venir {
    margin-top: 18px;
    color: #999;
    font-size: 14px;
}
/* ================================================================
   PAGE PRODUITS - grille de vignettes + formulaire d'ajout
   ================================================================ */

/* Bouton d'ajout flottant style "+" et formulaire */
.bloc-ajout {
    background: #fff;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,.06);
    margin-bottom: 24px;
}
.bloc-ajout h3 {
    color: var(--bleu);
    margin-bottom: 14px;
    font-size: 17px;
}

/* Zone où l'on tape pour choisir/prendre une photo */
.zone-photo {
    border: 2px dashed var(--bordure);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    color: var(--brun-clair);
    cursor: pointer;
    background: #FBF7F1;
}
.zone-photo i { font-size: 40px; color: var(--orange); }
.zone-photo p { margin-top: 8px; font-size: 14px; }

/* Aperçu de la photo choisie */
#apercu {
    max-width: 140px;
    border-radius: 12px;
    margin-top: 12px;
    display: none;   /* caché tant qu'aucune photo n'est choisie */
}

/* La grille de produits : s'adapte à la largeur, vignettes de ~150px */
.grille {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

/* Une vignette produit */
.produit {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
    position: relative;
}
.produit img {
    width: 100%;
    height: 120px;
    object-fit: cover;   /* remplit le cadre sans déformer */
    display: block;
}
.produit .infos { padding: 10px 12px; }
.produit .prix {
    font-size: 17px;
    font-weight: 700;
    color: var(--bleu);
}
.produit .nom-p {
    font-size: 13px;
    color: var(--brun-clair);
    margin-top: 2px;
}

/* Pastille de stock en haut à droite de la vignette */
.pastille {
    position: absolute;
    top: 8px; right: 8px;
    width: 26px; height: 26px;
    border-radius: 50%;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.pastille.ok    { background: #27AE60; }  /* stock correct : vert */
.pastille.bas   { background: var(--orange); }  /* stock faible : orange */
.pastille.vide  { background: #C0392B; }  /* rupture : rouge */

/* Message quand il n'y a encore aucun produit */
.vide-msg {
    text-align: center;
    color: var(--brun-clair);
    padding: 30px;
    font-size: 15px;
}
/* ================================================================
   CASES PIN - saisie du code secret en 4 cases séparées
   ================================================================ */
.pin-cases {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 8px;
}
.pin-cases input {
    width: 56px;
    height: 64px;
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: var(--bleu);
    border: 2px solid var(--bordure);
    border-radius: 14px;
    background: #fff;
    padding: 0;
}
.pin-cases input:focus {
    border-color: var(--orange);
    outline: none;
}
/* Une case remplie prend une bordure orange douce */
.pin-cases input.rempli {
    border-color: var(--orange);
    background: #FFF8F2;
}
/* ================================================================
   CAISSE - grille tactile de produits + panier
   ================================================================ */

/* La grille de produits en mode caisse (vignettes cliquables) */
.caisse-grille {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
    /* espace en bas pour ne pas cacher les produits derrière le panier fixe */
    padding-bottom: 200px;
}

/* Une vignette produit cliquable */
.caisse-produit {
    position: relative;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
    cursor: pointer;
    border: 3px solid transparent;
    transition: transform .1s, border-color .1s;
    user-select: none;
}
/* Petit effet quand on touche */
.caisse-produit:active { transform: scale(.95); }
/* Bordure orange quand le produit est dans le panier */
.caisse-produit.actif { border-color: var(--orange); }

.caisse-produit img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    display: block;
}
.caisse-produit .cp-infos { padding: 6px 8px; text-align: center; }
.caisse-produit .cp-prix {
    font-size: 15px;
    font-weight: 700;
    color: var(--bleu);
}
.caisse-produit .cp-nom {
    font-size: 11px;
    color: var(--brun-clair);
}
/* Badge quantité (combien de fois ce produit est dans le panier) */
.caisse-produit .cp-qte {
    position: absolute;
    top: 6px; right: 6px;
    background: var(--orange);
    color: #fff;
    width: 28px; height: 28px;
    border-radius: 50%;
    font-size: 14px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

/* LE PANIER : barre fixe en bas de l'écran */
.panier {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bleu);
    color: #fff;
    padding: 16px 20px;
    box-shadow: 0 -4px 20px rgba(0,0,0,.25);
}
.panier .total-ligne {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.panier .total-label { font-size: 15px; opacity: .85; }
.panier .total-montant { font-size: 30px; font-weight: 700; }

.panier .boutons { display: flex; gap: 10px; }
.panier .btn-vider {
    background: transparent;
    border: 1.5px solid rgba(255,255,255,.5);
    color: #fff;
    padding: 14px;
    border-radius: 12px;
    font-size: 15px;
    width: 90px;
    cursor: pointer;
    margin: 0;
}
.panier .btn-encaisser {
    flex: 1;
    background: var(--orange);
    color: #fff;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    margin: 0;
}
.panier .btn-encaisser:disabled {
    opacity: .5;
}
/* Pastille de stock sur les vignettes de la caisse (en bas à gauche) */
.caisse-produit .cp-stock {
    position: absolute;
    top: 6px; left: 6px;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 3px;
}
/* Couleur d'alerte quand le stock est faible ou nul */
.caisse-produit .cp-stock.bas  { background: rgba(232,100,28,.9); }
.caisse-produit .cp-stock.vide { background: rgba(192,57,43,.9); }
/* Un produit épuisé (stock 0) : grisé et non cliquable */
.caisse-produit.epuise {
    opacity: .45;
    cursor: not-allowed;
    filter: grayscale(100%);
}
/* ================================================================
   TABLEAU DE BORD DU JOUR - cartes de stats + liste des ventes
   ================================================================ */

/* La grande carte du total encaissé */
.stat-principale {
    background: #27AE60;
    color: #fff;
    padding: 28px 24px;
    border-radius: 18px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(39,174,96,.3);
    margin-bottom: 16px;
}
.stat-principale .label { font-size: 15px; opacity: .9; }
.stat-principale .montant { font-size: 42px; font-weight: 700; margin-top: 6px; }
.stat-principale .date-jour { font-size: 13px; opacity: .8; margin-top: 4px; }

/* Deux petites cartes côte à côte */
.stats-duo {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}
.stat-carte {
    background: #fff;
    padding: 18px;
    border-radius: 14px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,.05);
}
.stat-carte .chiffre { font-size: 30px; font-weight: 700; color: var(--bleu); }
.stat-carte .titre-carte { font-size: 13px; color: var(--brun-clair); margin-top: 4px; }
.stat-carte.alerte .chiffre { color: var(--orange); }

/* Titre de section */
.section-titre {
    font-size: 16px;
    font-weight: 600;
    color: var(--bleu);
    margin: 0 0 12px;
}

/* Liste des ventes du jour */
.liste-ventes { display: flex; flex-direction: column; gap: 8px; }
.vente-item {
    background: #fff;
    padding: 14px 16px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.vente-item .heure { font-size: 14px; color: var(--brun-clair); }
.vente-item .montant-v { font-size: 18px; font-weight: 700; color: #27AE60; }

/* Boutons d'action rapide */
.actions-rapides { display: flex; gap: 12px; margin-bottom: 24px; }
.actions-rapides a {
    flex: 1;
    text-decoration: none;
    text-align: center;
    padding: 18px 12px;
    border-radius: 14px;
    font-weight: 600;
    color: #fff;
}
.action-caisse   { background: var(--orange); }
.action-produits { background: var(--bleu); }
.actions-rapides a .ico { font-size: 26px; display: block; margin-bottom: 4px; }

/* ================================================================
   VUE MENSUELLE / ANNUELLE
   ================================================================ */

/* Carte du total du mois */
.stat-mois {
    background: var(--bleu);
    color: #fff;
    padding: 20px 24px;
    border-radius: 16px;
    margin: 8px 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.stat-mois .label-m { font-size: 14px; opacity: .85; }
.stat-mois .val-m { font-size: 26px; font-weight: 700; }
.stat-mois .annee-total { text-align: right; font-size: 13px; opacity: .8; }

/* Le graphique en barres des 12 mois */
.graphique {
    background: #fff;
    padding: 20px 16px 12px;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,.05);
    margin-bottom: 24px;
}
.barres {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 140px;
    gap: 4px;
}
.barre-mois {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}
.barre-mois .barre-fill {
    width: 100%;
    max-width: 22px;
    background: var(--orange);
    border-radius: 4px 4px 0 0;
    min-height: 3px;
    transition: height .3s;
}
.barre-mois.actuel .barre-fill { background: var(--bleu); }
.barre-mois .label-mois {
    font-size: 10px;
    color: var(--brun-clair);
    margin-top: 6px;
}
.barre-mois.actuel .label-mois { color: var(--bleu); font-weight: 700; }
/* ================================================================
   PAGE DÉPENSES
   ================================================================ */

/* Carte du total des dépenses du mois (rouge : c'est de l'argent qui sort) */
.stat-depenses {
    background: #C0392B;
    color: #fff;
    padding: 24px;
    border-radius: 18px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(192,57,43,.3);
    margin-bottom: 20px;
}
.stat-depenses .label { font-size: 15px; opacity: .9; }
.stat-depenses .montant { font-size: 36px; font-weight: 700; margin-top: 6px; }

/* Sélecteur de catégories (grille de pastilles) */
.cat-choix {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    margin-top: 8px;
}
.cat-pastille {
    background: #fff;
    border: 2px solid var(--bordure);
    border-radius: 12px;
    padding: 10px 6px;
    text-align: center;
    cursor: pointer;
    font-size: 12px;
    color: var(--brun);
}
.cat-pastille .emoji { font-size: 22px; display: block; margin-bottom: 4px; }
/* La catégorie sélectionnée devient orange */
.cat-pastille.choisie {
    border-color: var(--orange);
    background: #FFF8F2;
}

/* Ligne d'une dépense dans la liste */
.depense-item {
    background: #fff;
    padding: 14px 16px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    margin-bottom: 8px;
}
.depense-item .d-gauche { display: flex; align-items: center; gap: 10px; }
.depense-item .d-emoji { font-size: 22px; }
.depense-item .d-cat { font-size: 14px; font-weight: 600; color: var(--bleu); }
.depense-item .d-desc { font-size: 12px; color: var(--brun-clair); }
.depense-item .d-montant { font-size: 17px; font-weight: 700; color: #C0392B; }
.depense-item .d-suppr {
    background: none; border: none; color: #C0392B; cursor: pointer;
    font-size: 18px; width: auto; margin: 0 0 0 10px; padding: 0;
}
/* ================================================================
   BÉNÉFICE (résumé ventes / dépenses / résultat)
   ================================================================ */
.bloc-benefice {
    background: #fff;
    border-radius: 18px;
    padding: 20px 24px;
    box-shadow: 0 4px 16px rgba(0,0,0,.06);
    margin-bottom: 24px;
}
.benefice-ligne {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 15px;
}
.benefice-ligne .label-b { color: var(--brun); }
.benefice-ligne .val-ventes   { color: #27AE60; font-weight: 600; }
.benefice-ligne .val-depenses { color: #C0392B; font-weight: 600; }

/* La ligne finale du bénéfice, séparée par un trait */
.benefice-total {
    border-top: 2px solid #eee;
    margin-top: 6px;
    padding-top: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.benefice-total .label-final { font-size: 16px; font-weight: 600; color: var(--bleu); }
.benefice-total .val-final { font-size: 26px; font-weight: 700; }
/* Vert si bénéfice positif, rouge si négatif */
.val-final.positif { color: #27AE60; }
.val-final.negatif { color: #C0392B; }
/* ================================================================
   PAGE RÉCAP ANNUEL
   ================================================================ */

/* Navigation entre années (flèches + année au centre) */
.nav-annee {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bleu);
    color: #fff;
    padding: 14px 20px;
    border-radius: 14px;
    margin-bottom: 20px;
}
.nav-annee a, .nav-annee .fleche-off {
    color: #fff;
    text-decoration: none;
    font-size: 24px;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    background: rgba(255,255,255,.15);
}
.nav-annee .fleche-off { opacity: .3; }
.nav-annee .annee-titre { font-size: 22px; font-weight: 700; }

/* Trois cartes de totaux annuels */
.totaux-annee {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}
.carte-total {
    padding: 16px;
    border-radius: 14px;
    text-align: center;
    color: #fff;
}
.carte-total .ct-label { font-size: 13px; opacity: .9; }
.carte-total .ct-val { font-size: 20px; font-weight: 700; margin-top: 4px; }
.carte-total.ventes   { background: #27AE60; }
.carte-total.depenses { background: #C0392B; }
.carte-total.benefice { grid-column: 1 / -1; } /* prend toute la largeur */
.carte-total.benefice.positif { background: var(--bleu); }
.carte-total.benefice.negatif { background: #922B21; }
.carte-total.benefice .ct-val { font-size: 26px; }

/* Liste des 12 mois */
.mois-liste { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.mois-item {
    background: #fff;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    text-decoration: none;
    color: inherit;
    display: block;
}
.mois-item.vide { opacity: .5; }
.mois-item .mois-haut {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.mois-item .mois-nom { font-size: 16px; font-weight: 600; color: var(--bleu); }
.mois-item .mois-benef { font-size: 16px; font-weight: 700; }
.mois-item .mois-benef.positif { color: #27AE60; }
.mois-item .mois-benef.negatif { color: #C0392B; }
.mois-item .mois-bas {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--brun-clair);
}
.mois-item .mois-bas .v { color: #27AE60; }
.mois-item .mois-bas .d { color: #C0392B; }
/* ================================================================
   BOUTONS D'ACTION du tableau de bord (grille alignée, icônes larges)
   ================================================================ */
.grille-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);  /* 2 colonnes égales */
    gap: 12px;
    margin-bottom: 24px;
}
.btn-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    color: #fff;
    padding: 22px 12px;
    border-radius: 16px;
    min-height: 130px;          /* même hauteur pour tous */
    box-sizing: border-box;
}
/* L'icône : nettement plus grande que le texte */
.btn-action .ico-action {
    font-size: 46px;            /* icône bien lisible */
    line-height: 1;
    margin-bottom: 10px;
}
/* Le texte : plus petit que l'icône */
.btn-action .txt-action {
    font-size: 16px;
    font-weight: 600;
}
/* Couleurs par type de bouton */
.btn-action.act-caisse   { background: var(--orange); }
.btn-action.act-depenses { background: #C0392B; }
.btn-action.act-produits { background: var(--bleu); }
.btn-action.act-recap    { background: #34495E; }
/* ================================================================
   RÉCAP PAR PRODUIT (quantités vendues du jour)
   ================================================================ */
.recap-produit-item {
    background: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    margin-bottom: 8px;
}
.recap-produit-item .rp-gauche { display: flex; align-items: center; gap: 12px; }
/* Pastille du nombre vendu */
.recap-produit-item .rp-qte {
    background: var(--bleu);
    color: #fff;
    min-width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 700;
    padding: 0 8px;
}
.recap-produit-item .rp-nom { font-size: 15px; font-weight: 600; color: var(--bleu); }
.recap-produit-item .rp-label { font-size: 12px; color: var(--brun-clair); }
.recap-produit-item .rp-montant { font-size: 16px; font-weight: 700; color: #27AE60; }
/* ================================================================
   CLIENTS À CRÉDIT (bons)
   ================================================================ */

/* Carte du total dû par tous les clients */
.stat-du {
    background: var(--orange);
    color: #fff;
    padding: 24px;
    border-radius: 18px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(232,100,28,.3);
    margin-bottom: 20px;
}
.stat-du .label { font-size: 15px; opacity: .9; }
.stat-du .montant { font-size: 36px; font-weight: 700; margin-top: 6px; }

/* Une ligne client dans la liste */
.client-item {
    background: #fff;
    padding: 14px 16px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
    margin-bottom: 10px;
    text-decoration: none;
    color: inherit;
}
/* Photo ronde du client (ou initiale si pas de photo) */
.client-photo {
    width: 52px; height: 52px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bleu);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    flex-shrink: 0;
}
.client-infos { flex: 1; }
.client-nom { font-size: 16px; font-weight: 600; color: var(--bleu); }
.client-tel { font-size: 13px; color: var(--brun-clair); }
/* Montant dû par ce client */
.client-du {
    text-align: right;
    flex-shrink: 0;
}
.client-du .du-montant { font-size: 17px; font-weight: 700; color: #C0392B; }
.client-du .du-label { font-size: 11px; color: var(--brun-clair); }
.client-du.solde .du-montant { color: #27AE60; }
/* ================================================================
   FICHE CLIENT (détail des bons)
   ================================================================ */
.fiche-tete {
    background: #fff;
    border-radius: 18px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0,0,0,.06);
    margin-bottom: 16px;
}
.fiche-tete .fiche-photo {
    width: 80px; height: 80px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bleu);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 34px; font-weight: 700;
    margin: 0 auto 12px;
}
.fiche-tete .fiche-nom { font-size: 20px; font-weight: 700; color: var(--bleu); }
.fiche-tete .fiche-tel { font-size: 14px; color: var(--brun-clair); margin-top: 4px; }
.fiche-tete .fiche-du { margin-top: 14px; }
.fiche-tete .fiche-du .label { font-size: 13px; color: var(--brun-clair); }
.fiche-tete .fiche-du .montant { font-size: 32px; font-weight: 700; color: #C0392B; }
.fiche-tete .fiche-du .montant.solde { color: #27AE60; }

/* Bouton rappel WhatsApp */
.btn-whatsapp {
    display: block;
    background: #25D366;
    color: #fff;
    text-decoration: none;
    text-align: center;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    margin-top: 12px;
}

/* Un bon dans la liste */
.bon-item {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
    margin-bottom: 10px;
}
.bon-item.regle { opacity: .6; }
.bon-haut {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}
.bon-montant { font-size: 18px; font-weight: 700; color: var(--bleu); }
.bon-desc { font-size: 13px; color: var(--brun-clair); }
.bon-date { font-size: 12px; color: var(--brun-clair); }
.bon-reste {
    text-align: right;
}
.bon-reste .reste-val { font-size: 18px; font-weight: 700; color: #C0392B; }
.bon-reste .reste-val.paye { color: #27AE60; }
.bon-reste .reste-label { font-size: 11px; color: var(--brun-clair); }

/* Formulaire de remboursement intégré au bon */
.rembourse-form {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}
.rembourse-form input {
    flex: 1; margin: 0; padding: 10px; font-size: 15px;
}
.rembourse-form button {
    width: auto; margin: 0; padding: 10px 18px;
    background: #27AE60; font-size: 14px;
}
/* ================================================================
   FENÊTRE DE CHOIX DU PAIEMENT (caisse)
   ================================================================ */
.modal-fond {
    display: none;              /* caché par défaut */
    position: fixed;
    inset: 0;                   /* couvre tout l'écran */
    background: rgba(0,0,0,.5);
    z-index: 1000;
    align-items: flex-end;      /* la fenêtre glisse depuis le bas */
    justify-content: center;
}
.modal-fond.ouvert { display: flex; }
.modal-boite {
    background: #fff;
    width: 100%;
    max-width: 500px;
    border-radius: 20px 20px 0 0;
    padding: 24px 20px 30px;
    box-shadow: 0 -4px 20px rgba(0,0,0,.2);
}
.modal-titre {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--bleu);
    margin-bottom: 4px;
}
.modal-montant {
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    color: #27AE60;
    margin-bottom: 20px;
}
/* Les 3 boutons de mode de paiement */
.mode-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 18px;
    margin-bottom: 12px;
    border: none;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    color: #fff;
}
.mode-btn .mode-ico { font-size: 26px; }
.mode-especes { background: #27AE60; }
.mode-mobile  { background: #8E44AD; }
.mode-bon     { background: var(--orange); }
.modal-annuler {
    width: 100%;
    padding: 14px;
    background: #eee;
    color: var(--brun);
    border: none;
    border-radius: 12px;
    font-size: 15px;
    cursor: pointer;
    margin-top: 4px;
}
/* Sous-fenêtre : choix du client pour le bon */
.choix-client { display: none; }
.choix-client.ouvert { display: block; }
.client-select-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    border: 1.5px solid var(--bordure);
    margin-bottom: 8px;
}
.client-select-item.choisi { border-color: var(--orange); background: #FFF8F2; }
.client-select-item .cs-photo {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--bleu); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; flex-shrink: 0;
}
/* Par défaut, les clients à jour (sans dette) sont cachés dans la liste.
   Ils réapparaissent lors d'une recherche. */
.client-ajour { display: none; }

/* ================================================================
   RÉCAP MENSUEL GROUPÉ PAR JOUR
   ================================================================ */
.jour-groupe {
    margin-bottom: 20px;
}
/* L'en-tête du jour (date + bénéfice du jour) */
.jour-tete {
    background: var(--bleu);
    color: #fff;
    padding: 12px 16px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.jour-tete .jour-date { font-size: 15px; font-weight: 700; }
.jour-tete .jour-benef { font-size: 15px; font-weight: 700; }
/* Ligne des sous-totaux du jour */
.jour-totaux {
    display: flex;
    gap: 16px;
    background: #F4F6F8;
    padding: 8px 16px;
    font-size: 13px;
}
.jour-totaux .jt-v { color: #27AE60; font-weight: 600; }
.jour-totaux .jt-d { color: #C0392B; font-weight: 600; }
/* Le corps du jour (les transactions) */
.jour-corps {
    background: #fff;
    border-radius: 0 0 12px 12px;
    padding: 8px 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.jour-corps .transac {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px;
    border-bottom: 1px solid #f5f5f5;
    font-size: 14px;
}
.jour-corps .transac:last-child { border-bottom: none; }
.jour-corps .transac .t-heure { color: var(--brun-clair); font-size: 12px; }
.jour-corps .transac .t-montant-v { color: #27AE60; font-weight: 700; }
.jour-corps .transac .t-montant-d { color: #C0392B; font-weight: 700; }
.jour-corps .transac .t-label { flex: 1; margin: 0 10px; }

/* ================================================================
   RÉCAP MENSUEL GROUPÉ PAR JOUR
   ================================================================ */
.jour-groupe {
    margin-bottom: 20px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
/* En-tête du jour (date + bénéfice) */
.jour-tete {
    background: var(--bleu);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.jour-tete .jour-date { font-size: 15px; font-weight: 700; }
.jour-tete .jour-benef {
    font-size: 16px;
    font-weight: 700;
    background: rgba(255,255,255,.15);
    padding: 4px 12px;
    border-radius: 20px;
}
/* Ligne des sous-totaux */
.jour-totaux {
    display: flex;
    gap: 16px;
    background: #EEF2F5;
    padding: 10px 16px;
    font-size: 13px;
}
.jour-totaux .jt-v { color: #1E8449; font-weight: 600; }
.jour-totaux .jt-d { color: #C0392B; font-weight: 600; }
/* Corps (les transactions) */
.jour-corps {
    background: #fff;
    padding: 6px 16px;
}
.jour-corps .transac {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f2f2f2;
    font-size: 14px;
}
.jour-corps .transac:last-child { border-bottom: none; }
.jour-corps .transac .t-heure {
    color: var(--brun-clair);
    font-size: 13px;
    min-width: 54px;
}
.jour-corps .transac .t-label {
    flex: 1;
    margin: 0 10px;
    color: var(--brun);
}
.jour-corps .transac .t-montant-v { color: #27AE60; font-weight: 700; }
.jour-corps .transac .t-montant-d { color: #C0392B; font-weight: 700; }