/* TicketPro — feuille de style mobile d'abord */
:root {
    --vert: #14532d;
    --vert-clair: #166534;
    --vert-pale: #dcfce7;
    --jaune: #facc15;
    --fond: #f4f6f4;
    --carte: #ffffff;
    --texte: #1c2620;
    --texte-doux: #5b6b61;
    --bord: #d9e1db;
    --rouge: #b91c1c;
    --rouge-pale: #fee2e2;
    --bleu-pale: #e0ecff;
    --bleu: #1e40af;
    --rayon: 12px;
    --nav-h: 64px;
}

/* Police Poppins (SIL Open Font License), servie par l'application : marche hors connexion. */
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/poppins-400.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/poppins-500.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/poppins-600.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/poppins-700.woff2") format("woff2"); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    color: var(--texte);
    background: var(--fond);
}

body.avec-menu { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }

a { color: var(--vert-clair); }

/* ---------- Barre du haut ---------- */
.barre {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top));
    background: var(--vert); color: #fff;
}
.marque { color: #fff; font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.barre-util { display: flex; align-items: center; gap: 8px; min-width: 0; }
.util-nom { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; font-size: .9rem; }

.badge {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    font-size: .72rem; font-weight: 600; white-space: nowrap;
    background: rgba(255,255,255,.18); color: #fff;
}
.badge-super_admin { background: var(--jaune); color: #3b2f00; }

/* ---------- Contenu ---------- */
.contenu { max-width: 960px; margin: 0 auto; padding: 16px; }
.sans-menu .contenu { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }
.titre-page { font-size: 1.35rem; margin: 4px 0 16px; }

.carte {
    background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon);
    padding: 20px;
}
.carte-auth { width: 100%; max-width: 420px; margin: 0 auto; }
.carte-auth h1 { text-align: center; margin: 4px 0; font-size: 1.5rem; }
.logo { text-align: center; font-size: 2.6rem; }
.sous-titre { text-align: center; color: var(--texte-doux); margin: 0 0 16px; }
.carte-auth form label, .carte-auth form input { text-align: center; }

/* ---------- Formulaires ---------- */
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: .95rem; }
input, select, textarea {
    width: 100%; padding: 12px 14px; font: inherit;
    border: 1px solid var(--bord); border-radius: 10px; background: #fff; color: var(--texte);
}
input:focus, select:focus, textarea:focus { outline: 3px solid var(--vert-pale); border-color: var(--vert-clair); }
.aide { display: block; color: var(--texte-doux); font-size: .85rem; margin-top: 4px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 12px 18px; border-radius: 10px; border: 1px solid transparent;
    font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn-principal { background: var(--vert-clair); color: #fff; }
.btn-principal:hover { background: var(--vert); }
.btn-bloc { width: 100%; margin-top: 20px; }
.btn-lien { background: none; border: 0; color: var(--vert-clair); font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }

.lien-bas { text-align: center; margin: 18px 0 0; }

/* ---------- Alertes ---------- */
.alerte { padding: 12px 14px; border-radius: 10px; margin: 0 0 14px; }
.alerte-succes { background: var(--vert-pale); color: var(--vert); }
.alerte-erreur { background: var(--rouge-pale); color: var(--rouge); }
.alerte-info   { background: var(--bleu-pale); color: var(--bleu); }

/* ---------- Tableau de bord ---------- */
.grille-chiffres { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
.chiffre {
    background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon);
    padding: 14px; display: flex; flex-direction: column;
}
.chiffre-valeur { font-size: 1.6rem; font-weight: 700; color: var(--vert); }
.chiffre-libelle { color: var(--texte-doux); font-size: .85rem; }
.chiffre-alerte { border-color: var(--jaune); background: #fffbe6; }

.grille-modules { display: grid; grid-template-columns: 1fr; gap: 10px; }
.module {
    display: flex; flex-direction: column; gap: 4px;
    background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon);
    padding: 16px; color: var(--texte); text-decoration: none;
}
a.module:hover { border-color: var(--vert-clair); }
.module span { color: var(--texte-doux); font-size: .9rem; }
.module-bientot { opacity: .65; }
.badge-bientot { font-style: normal; font-size: .75rem; color: var(--texte-doux); }

@media (min-width: 640px) {
    .grille-chiffres { grid-template-columns: repeat(4, 1fr); }
    .grille-modules { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Navigation du bas ---------- */
.nav-bas {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    display: flex; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: #fff; border-top: 1px solid var(--bord);
}
.nav-bas > a, .nav-bas > form { flex: 1; display: flex; }
.nav-bas a, .nav-bas button {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    font: inherit; font-size: .75rem; color: var(--texte-doux); text-decoration: none;
    background: none; border: 0; cursor: pointer;
}
.nav-bas .ico { font-size: 1.25rem; line-height: 1; }
.nav-bas .actif { color: var(--vert-clair); font-weight: 700; }

/* ---------- Étape 2 : gestion ---------- */
.entete-page { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.entete-page .titre-page { margin: 0; }
.contenu > .entete-page { margin-bottom: 14px; }
.contenu > .carte + .carte, .contenu > .carte + a.carte, .contenu > .carte { margin-bottom: 14px; }
.carte h2 { font-size: 1.1rem; margin: 0 0 8px; }

a.chiffre { text-decoration: none; color: inherit; }
a.chiffre:hover { border-color: var(--vert-clair); }

.btn-secondaire { background: #fff; color: var(--vert-clair); border-color: var(--vert-clair); }
.btn-secondaire:hover { background: var(--vert-pale); }
.btn-danger { background: var(--rouge); color: #fff; }
.btn-danger:hover { background: #991b1b; }
.btn:disabled { opacity: .6; cursor: wait; }

.filtres { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.filtres input[type="search"] { grid-column: 1 / -1; }
.filtres .btn { grid-column: 1 / -1; }
@media (min-width: 640px) {
    .filtres { grid-template-columns: 2fr 1fr 1fr auto; }
    .filtres input[type="search"], .filtres .btn { grid-column: auto; }
}
.compteur { color: var(--texte-doux); font-size: .9rem; margin: 6px 0 10px; }
.vide { text-align: center; color: var(--texte-doux); padding: 30px 10px; background: var(--carte); border: 1px dashed var(--bord); border-radius: var(--rayon); }

.liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ligne-liste {
    display: flex; flex-direction: column; gap: 4px;
    background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon);
    padding: 12px 14px; color: var(--texte); text-decoration: none;
}
a.ligne-liste:hover { border-color: var(--vert-clair); }
.ligne-principale { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ligne-secondaire { color: var(--texte-doux); font-size: .88rem; }

.pastille { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.pastille-actif { background: var(--vert-pale); color: var(--vert); }
.pastille-en_attente { background: #fef3c7; color: #92400e; }
.pastille-bloque { background: var(--rouge-pale); color: var(--rouge); }

.details { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 14px 0; }
.details dt { color: var(--texte-doux); }
.details dd { margin: 0; font-weight: 500; }

.actions { display: flex; flex-direction: column; gap: 8px; }
.actions .btn { width: 100%; }
@media (min-width: 640px) { .actions { flex-direction: row; flex-wrap: wrap; } .actions .btn { width: auto; } }

.historique { list-style: none; margin: 0; padding: 0; }
.historique li { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid var(--bord); }
.historique li:last-child { border-bottom: 0; }
.historique span, .historique small { color: var(--texte-doux); font-size: .85rem; }

.pagination { display: flex; justify-content: space-between; align-items: center; margin: 14px 0; }
.unite { font-weight: 400; color: var(--texte-doux); }

/* ---------- Étape 3 : tableaux ---------- */
.tableau { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tableau th, .tableau td { padding: 8px 6px; border-bottom: 1px solid var(--bord); text-align: left; vertical-align: middle; }
.tableau thead th { color: var(--texte-doux); font-weight: 600; font-size: .8rem; }
.tableau input[type="number"] { max-width: 120px; padding: 8px 10px; }
.tableau .aide { margin: 0; }
.centre { text-align: center !important; }
input.case { width: 22px; height: 22px; accent-color: var(--vert-clair); }
.tableau-chiffres td, .tableau-chiffres thead th:not(:first-child) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tableau-chiffres tbody th { color: var(--texte-doux); }
.defilement { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.onglets { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 6px; }
.onglets a { white-space: nowrap; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--bord); text-decoration: none; color: var(--texte); font-size: .88rem; }
.onglets a.actif { background: var(--vert-clair); border-color: var(--vert-clair); color: #fff; }

/* ---------- Étape 4 : courses ---------- */
.titre-groupe { font-size: 1rem; color: var(--texte-doux); margin: 18px 0 8px; }
.pastille-course-ouverte { background: var(--vert-pale); color: var(--vert); }
.pastille-course-limite, .pastille-course-fermee { background: #fef3c7; color: #92400e; }
.pastille-course-annulee { background: var(--rouge-pale); color: var(--rouge); }
.pastille-course-terminee { background: #e5e7eb; color: #374151; }
.rebours { font-size: .85rem; color: var(--texte-doux); }
.rebours-urgent { color: #b45309; font-weight: 600; }
.rebours-fini { color: var(--rouge); font-weight: 600; }

.deux-colonnes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled { opacity: .7; }

.choix-rapides { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.choix-rapides button, .grille-chevaux button {
    font: inherit; border: 1px solid var(--bord); background: #fff; color: var(--texte);
    border-radius: 999px; padding: 6px 12px; cursor: pointer;
}
.choix-rapides button.actif { background: var(--vert-clair); border-color: var(--vert-clair); color: #fff; }

.cases { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.case-ligne { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 4px 0; }

.grille-chevaux { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin-bottom: 8px; }
.grille-chevaux button { border-radius: 10px; padding: 10px 0; font-weight: 600; }
.grille-chevaux button.np { background: var(--rouge-pale); border-color: var(--rouge); color: var(--rouge); text-decoration: line-through; }

/* ---------- Étape 5 : tickets ---------- */
.btn-petit { padding: 6px 12px; font-size: .85rem; }
.lien-bloc { display: block; text-decoration: none; }
.carte h2 { margin-top: 14px; }
.carte h2:first-child { margin-top: 0; }

.segments { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--vert-clair); border-radius: 10px; overflow: hidden; margin: 6px 0; }
.segments button { font: inherit; padding: 10px; border: 0; background: #fff; color: var(--vert-clair); cursor: pointer; }
.segments button + button { border-left: 1px solid var(--vert-clair); }
.segments button.actif { background: var(--vert-clair); color: #fff; font-weight: 600; }

.grille-jeu { grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); }
.grille-jeu button { position: relative; padding: 14px 0; font-size: 1.05rem; }
.grille-jeu button.champ { background: var(--vert-clair); border-color: var(--vert-clair); color: #fff; }
.grille-jeu button.base { background: var(--jaune); border-color: #ca8a04; color: #3b2f00; }
.grille-jeu button.base::after {
    content: attr(data-ordre); position: absolute; top: 2px; right: 5px; font-size: .65rem; font-weight: 700;
}
.grille-jeu button.np { background: #f3f4f6; color: #9ca3af; text-decoration: line-through; cursor: not-allowed; border-style: dashed; }
.legende { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--texte-doux); margin-bottom: 12px; }
.pt { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; border: 1px solid var(--bord); }
.pt-base { background: var(--jaune); } .pt-champ { background: var(--vert-clair); } .pt-np { background: #f3f4f6; border-style: dashed; }

.multiplicateur { display: flex; align-items: center; gap: 10px; margin: 8px 0 12px; flex-wrap: wrap; }
.multiplicateur button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--vert-clair); background: #fff; color: var(--vert-clair); font-size: 1.3rem; cursor: pointer; }
.multiplicateur output { min-width: 28px; text-align: center; font-weight: 700; font-size: 1.15rem; }
.multiplicateur > span:first-child { font-weight: 600; }

.resume { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; }
.resume-attente { background: #f3f4f6; color: var(--texte-doux); }
.resume-ok { background: var(--vert-pale); color: var(--vert); }

.ligne-panier { flex-direction: row !important; align-items: center; justify-content: space-between; gap: 10px; }
.ligne-panier > div { display: flex; flex-direction: column; min-width: 0; }
.ligne-panier span, .ecriture { font-family: ui-monospace, Consolas, monospace; color: var(--texte) !important; font-size: .95rem !important; word-break: break-word; }
.btn-retirer { width: 34px; height: 34px; flex: none; border-radius: 50%; border: 1px solid var(--bord); background: #fff; color: var(--rouge); font-size: 1.2rem; cursor: pointer; }

.totaux { border-top: 1px solid var(--bord); padding-top: 10px; }
.totaux dd { text-align: right; font-variant-numeric: tabular-nums; }
.totaux .total { font-size: 1.15rem; font-weight: 700; color: var(--vert); }

.pastille-ticket-attente { background: #fef3c7; color: #92400e; }
.pastille-ticket-info { background: var(--bleu-pale); color: var(--bleu); }
.pastille-ticket-ok { background: var(--vert-pale); color: var(--vert); }
.pastille-ticket-erreur { background: var(--rouge-pale); color: var(--rouge); }
.pastille-ticket-neutre { background: #e5e7eb; color: #374151; }

/* ---------- Étape 6 : paiement ---------- */
.carte-paiement {
    display: flex; flex-direction: column; gap: 4px; margin: 10px 0; padding: 14px;
    border: 2px solid var(--bord); border-radius: var(--rayon); background: #fff; cursor: pointer; font-weight: 400;
}
.carte-paiement.choisie { border-color: var(--vert-clair); background: #f6fdf8; }
.carte-paiement input[type="radio"] { width: 20px; height: 20px; accent-color: var(--vert-clair); margin: 0 8px 0 0; vertical-align: -3px; }
.cp-choix { display: flex; align-items: center; margin: 0; cursor: pointer; }
.cp-moyen { font-weight: 700; }
.cp-numero { font-size: 1.5rem; font-weight: 700; letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.cp-nom { font-size: 1.05rem; }
.cp-nom strong { text-transform: uppercase; }
.cp-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.paiement .montant { font-size: 1.2rem; color: var(--vert); }
details.refus { flex: 1; }
details.refus > summary { list-style: none; width: 100%; }
details.refus > summary::-webkit-details-marker { display: none; }
details.refus[open] > summary { opacity: .6; }
@media (min-width: 640px) { details.refus > summary { width: auto; } }

/* ---------- Étape 7 : vendeurs ---------- */
img.preuve { display: block; width: 100%; max-height: 420px; object-fit: contain; background: #f3f4f6; border-radius: 10px; margin-top: 10px; }
.ligne-liste.en-cours { border: 2px solid var(--jaune); background: #fffbe6; }
.form-prendre { margin-top: 8px; }
.carte form + form { margin-top: 10px; }
input[type="file"] { padding: 10px; background: #f9fafb; }

/* ---------- Étape 8 : installation ---------- */
.bandeau-installer {
    position: fixed; left: 10px; right: 10px; z-index: 20;
    bottom: calc(10px + env(safe-area-inset-bottom));
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; background: #fff; border: 1px solid var(--bord); border-radius: 14px;
    box-shadow: 0 6px 24px rgba(0,0,0,.15); max-width: 520px; margin: 0 auto;
}
.avec-menu .bandeau-installer { bottom: calc(var(--nav-h) + 10px + env(safe-area-inset-bottom)); }
.bandeau-installer img { border-radius: 10px; flex: none; }
.bi-texte { display: flex; flex-direction: column; min-width: 0; flex: 1; font-size: .85rem; line-height: 1.3; }
.bi-texte span { color: var(--texte-doux); }
.bi-fermer { flex: none; width: 32px; height: 32px; border: 0; background: none; font-size: 1.4rem; color: var(--texte-doux); cursor: pointer; }
/* Application installée : la barre du haut tient compte de l'encoche */
@media (display-mode: standalone) { .barre { padding-top: calc(12px + env(safe-area-inset-top)); } }

.logo img { border-radius: 18px; }

/* ---------- Étape 9 : notifications ---------- */
.cloche { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; text-decoration: none; font-size: 1.15rem; flex: none; }
.cloche-nb { position: absolute; top: 0; right: -2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--jaune); color: #3b2f00; font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center; }
.notif.non-lue { border-left: 4px solid var(--vert-clair); background: #f6fdf8; }
.bn-ico { font-size: 1.6rem; flex: none; }
textarea { width: 100%; padding: 12px 14px; font: inherit; border: 1px solid var(--bord); border-radius: 10px; resize: vertical; }

/* ---------- Étape 10 : rapports ---------- */
.filtres-periode { grid-template-columns: 1fr 1fr; }
.filtres-periode .btn { grid-column: 1 / -1; }
@media (min-width: 640px) { .filtres-periode { grid-template-columns: 1fr 1fr auto; } .filtres-periode .btn { grid-column: auto; } }
.barre-part { display: inline-block; vertical-align: middle; width: 48px; height: 8px; margin-right: 6px; border-radius: 4px;
    background: linear-gradient(to right, var(--vert-clair) var(--part), #e5e7eb var(--part)); }
.carte .entete-page h2 { margin: 0; }
.carte > .entete-page { margin-bottom: 8px; }

/* ---------- Connexion : rester connecté, empreinte ---------- */
.carte-auth .case-rester { justify-content: center; margin: 16px 0 4px; font-weight: 500; }
.zone-empreinte { margin-top: 4px; }
.zone-empreinte .btn span[aria-hidden] { font-size: 1.2rem; }
.separateur { display: flex; align-items: center; gap: 10px; color: var(--texte-doux); font-size: .85rem; margin: 14px 0; }
.separateur::before, .separateur::after { content: ""; flex: 1; border-top: 1px solid var(--bord); }
.liste-cles { list-style: none; padding: 0; margin: 0 0 12px; }
.liste-cles li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--bord); }
.liste-cles li:last-child { border-bottom: 0; }
.liste-cles .aide { margin: 0; }
.cle-ici { color: var(--vert-clair); font-weight: 600; }
