/* Zoundi — une seule feuille pour toute l'appli.
   Couleurs du dépôt : vert bouteille, ambre de la capsule, rouge du casier.
   Police Lexend, dessinée pour une lecture facile : chiffres larges, zéro sans barre. */

@font-face {
    font-family: "Lexend";
    src: url("../fonts/lexend-latin.woff2") format("woff2");
    font-weight: 300 800;
    font-display: swap;
}

:root {
    --encre: #16241e;
    --gris: #56675f;
    --trait: #c6d1ca;
    --fond: #ecf0ed;
    --surface: #ffffff;
    --vert: #0e4b39;
    --vert-fonce: #083327;
    --vert-clair: #dfece5;
    --ambre: #f2a90f;
    --ambre-fonce: #d48f00;
    --ambre-clair: #fdf0cf;
    --rouge: #b3311e;
    --rouge-clair: #fae5e0;
    --rayon: 10px;
    --police: "Lexend", system-ui, -apple-system, "Segoe UI", sans-serif;
    --barre: 60px;
}

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

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

body {
    margin: 0;
    font-family: var(--police);
    font-size: 17px;
    line-height: 1.45;
    color: var(--encre);
    background: var(--fond);
    font-variant-numeric: tabular-nums;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.75rem; font-weight: 800; line-height: 1.15; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; font-weight: 700; line-height: 1.25; }
h3 { font-size: 1rem; font-weight: 700; }
a { color: var(--vert); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--ambre); outline-offset: 2px; }

.discret { color: var(--gris); }
.petit { font-size: 0.9rem; }
.droite { text-align: right; }
.nombre { white-space: nowrap; }

/* ---------- Barre du haut et menu ---------- */

.barre {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--barre);
    padding: 0 16px;
    background: var(--vert);
    color: #fff;
}

.barre__marque {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.25rem;
}

.logo { width: 30px; height: 30px; color: var(--ambre); --logo-trou: var(--vert); flex: none; }

.barre__onglets { display: flex; align-self: stretch; gap: 4px; margin-left: 12px; }

.barre__onglets a {
    display: flex;
    align-items: center;
    padding: 0 22px;
    color: #cfe3d9;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    border-bottom: 5px solid transparent;
    border-top: 5px solid transparent;
}

.barre__onglets a[aria-current="page"] { color: #fff; border-bottom-color: var(--ambre); }

.barre__moi { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.barre__nom { font-weight: 600; }

.barre__quitter, .barre__menu {
    padding: 8px 14px;
    border: 1.5px solid #6f9a88;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}

.barre__menu { display: none; }

.cadre { display: flex; align-items: flex-start; }

.menu {
    position: sticky;
    top: var(--barre);
    flex: none;
    width: 232px;
    height: calc(100vh - var(--barre));
    overflow-y: auto;
    padding: 10px 12px 24px;
    background: var(--surface);
    border-right: 1.5px solid var(--trait);
}

.menu__groupe { margin: 18px 10px 6px; font-size: 0.85rem; font-weight: 700; color: var(--gris); }

.menu a {
    display: block;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--encre);
    text-decoration: none;
    font-weight: 600;
}

.menu a:hover { background: var(--fond); }
.menu a[aria-current="page"] { background: var(--vert); color: #fff; }

.page { flex: 1; min-width: 0; padding: 24px clamp(14px, 3vw, 36px) 80px; }
.role-gerant .page { max-width: 1280px; }

.page__tete {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    margin-bottom: 20px;
}

.page__tete p { color: var(--gris); margin-top: 4px; }
.page__actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Boutons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 10px 18px;
    border: 1.5px solid var(--trait);
    border-radius: var(--rayon);
    background: var(--surface);
    color: var(--encre);
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    line-height: 1.2;
}

.btn:hover { border-color: var(--gris); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* L'action principale de l'écran : une seule par écran */
.btn--principal { background: var(--ambre); border-color: var(--ambre-fonce); }
.btn--principal:hover { background: #f7b62b; border-color: var(--ambre-fonce); }

.btn--vert { background: var(--vert); border-color: var(--vert); color: #fff; }
.btn--vert:hover { background: var(--vert-fonce); border-color: var(--vert-fonce); }
.btn--danger { color: var(--rouge); border-color: #e0b1a8; }
.btn--danger:hover { background: var(--rouge-clair); border-color: var(--rouge); }
.btn--grand { min-height: 64px; padding: 14px 24px; font-size: 1.2rem; }
.btn--petit { min-height: 38px; padding: 6px 12px; font-size: 0.92rem; }
.btn--bloc { display: flex; width: 100%; }
.btn--lien { border: 0; background: none; padding: 4px; min-height: 0; color: var(--vert); text-decoration: underline; }

/* ---------- Champs ---------- */

.champ { display: block; margin-bottom: 14px; }
.champ > span { display: block; margin-bottom: 5px; font-weight: 700; }
.champ small { display: block; margin-top: 4px; color: var(--gris); }

.saisie, select.saisie, textarea.saisie {
    width: 100%;
    min-height: 50px;
    padding: 10px 14px;
    border: 1.5px solid #9aaaa1;
    border-radius: var(--rayon);
    background: var(--surface);
}

.saisie:focus { border-color: var(--vert); outline: 3px solid var(--vert-clair); outline-offset: 0; }
.saisie--court { width: 110px; }

.case { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; }
.case input { width: 24px; height: 24px; accent-color: var(--vert); }

.rangee { display: flex; flex-wrap: wrap; gap: 12px; }
.rangee > * { flex: 1 1 180px; }

/* Choix unique en gros boutons côte à côte */
.segment { display: flex; flex-wrap: wrap; gap: 8px; }

.segment button {
    flex: 1 1 0;
    min-height: 52px;
    padding: 8px 14px;
    border: 1.5px solid var(--trait);
    border-radius: var(--rayon);
    background: var(--surface);
    font-weight: 700;
    white-space: nowrap;
}

.segment button[aria-pressed="true"] { background: var(--vert); border-color: var(--vert); color: #fff; }

/* ---------- Onglets dans une page ---------- */

.onglets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; border-bottom: 2px solid var(--trait); }

.onglets button {
    padding: 12px 18px;
    margin-bottom: -2px;
    border: 0;
    border-bottom: 5px solid transparent;
    background: none;
    font-weight: 700;
    font-size: 1.08rem;
    color: var(--gris);
}

.onglets button[aria-selected="true"] { color: var(--encre); border-bottom-color: var(--vert); }

.pastille {
    display: inline-block;
    min-width: 26px;
    padding: 1px 8px;
    margin-left: 6px;
    border-radius: 13px;
    background: var(--ambre);
    color: var(--encre);
    font-size: 0.9rem;
    text-align: center;
}

.pastille:empty, .pastille[data-n="0"] { display: none; }

/* ---------- Surfaces, listes, tableaux ---------- */

.bloc {
    padding: 18px;
    background: var(--surface);
    border: 1.5px solid var(--trait);
    border-radius: var(--rayon);
}

.bloc + .bloc { margin-top: 16px; }
.bloc > h2 { margin-bottom: 12px; }

.vide { padding: 36px 16px; text-align: center; color: var(--gris); }
.vide strong { display: block; margin-bottom: 4px; font-size: 1.15rem; color: var(--encre); }

.defile { overflow-x: auto; }

.tableau { width: 100%; border-collapse: collapse; }

.tableau th {
    padding: 8px 10px;
    border-bottom: 2px solid var(--encre);
    text-align: left;
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
}

.tableau td { padding: 9px 10px; border-bottom: 1px solid var(--trait); vertical-align: middle; }
.tableau .droite { text-align: right; }
.tableau tr.total td { border-top: 2px solid var(--encre); border-bottom: 0; font-weight: 800; }
.tableau tr.groupe td { padding-top: 18px; font-weight: 800; background: none; border-bottom: 2px solid var(--trait); }
.tableau tbody tr.clic { cursor: pointer; }
.tableau tbody tr.clic:hover td { background: var(--fond); }
.tableau .inactif td { color: var(--gris); }
.tableau input.saisie { min-height: 40px; padding: 6px 8px; }

/* Tableau large (point du jour) : plus serré, les en-têtes passent à la ligne */
.tableau--serre { font-size: 0.9rem; }
.tableau--serre th { white-space: normal; vertical-align: bottom; padding: 6px 7px; }
.tableau--serre td { padding: 6px 7px; }
.tableau--serre td:first-child { white-space: nowrap; }

.colonnes { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; margin-top: 16px; }
.colonnes .bloc { margin-top: 0; }

.moins { color: var(--rouge); font-weight: 700; }
.plus { color: var(--vert); font-weight: 700; }

/* État d'une commande */
.etat {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
    background: var(--fond);
    color: var(--encre);
}

.etat--a_la_caisse, .etat--attente { background: var(--ambre-clair); color: #6b4700; }
.etat--payee { background: var(--vert-clair); color: var(--vert); }
.etat--partiel, .etat--credit { background: #e7e3f6; color: #3d2f85; }
.etat--annulee { background: var(--rouge-clair); color: var(--rouge); text-decoration: line-through; }

/* ---------- Chiffres clés ---------- */

.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }

.chiffre { padding: 14px 16px; background: var(--surface); border: 1.5px solid var(--trait); border-radius: var(--rayon); }
.chiffre span { display: block; font-size: 0.92rem; font-weight: 600; color: var(--gris); }
.chiffre strong { display: block; margin-top: 2px; font-size: 1.55rem; font-weight: 800; line-height: 1.15; white-space: nowrap; }
.chiffre small { display: block; margin-top: 2px; color: var(--gris); }
.chiffre--fort { background: var(--vert); border-color: var(--vert); color: #fff; }
.chiffre--fort span, .chiffre--fort small { color: #cfe3d9; }

.alerte {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--rayon);
    border: 1.5px solid #e6c35f;
    background: var(--ambre-clair);
    color: var(--encre);
    text-decoration: none;
    font-weight: 600;
}

.alerte + .alerte { margin-top: 8px; }
.alerte--grave { border-color: #dd9d91; background: var(--rouge-clair); }
.alerte::before { content: "!"; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--ambre); text-align: center; font-weight: 800; line-height: 26px; }
.alerte--grave::before { background: var(--rouge); color: #fff; }

.fil { list-style: none; margin: 0; padding: 0; }
.fil li { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--trait); }
.fil li:last-child { border-bottom: 0; }
.fil time { flex: none; width: 46px; color: var(--gris); font-size: 0.92rem; padding-top: 1px; }
.fil .fil__alerte { color: var(--rouge); font-weight: 700; }
.fil small { color: var(--gris); }

/* ---------- Commandes en cartes (caisse, magasin, commandes du jour) ---------- */

.cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }

.cmd {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    background: var(--surface);
    border: 1.5px solid var(--trait);
    border-left: 8px solid var(--ambre);
    border-radius: var(--rayon);
    text-align: left;
}

button.cmd:hover { border-color: var(--gris); border-left-color: var(--ambre-fonce); }
.cmd--calme { border-left-color: var(--trait); }
.cmd--annulee { border-left-color: var(--rouge); opacity: 0.7; }
.cmd__tete { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 10px; }
.cmd__num { font-weight: 800; font-size: 1.05rem; color: var(--gris); white-space: nowrap; }
.cmd__client { font-size: 1.3rem; font-weight: 800; line-height: 1.2; }
.cmd__total { font-size: 1.5rem; font-weight: 800; white-space: nowrap; }
.cmd__lignes { margin: 0; padding: 0; list-style: none; color: var(--gris); }
.cmd__lignes li { display: flex; justify-content: space-between; gap: 10px; }
.cmd__lignes b { color: var(--encre); }
.cmd__pied { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: auto; }
.cmd__pied .btn { flex: 1 1 auto; }

/* ---------- Prise de commande ---------- */

.comptoir { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }

.comptoir__choix { display: grid; gap: 14px; margin-bottom: 18px; }

.client-choisi {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1.5px solid var(--trait);
    border-radius: var(--rayon);
}

.client-choisi strong { font-size: 1.2rem; }

.familles { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.familles button {
    min-height: 50px;
    padding: 8px 18px;
    border: 1.5px solid var(--trait);
    border-radius: 25px;
    background: var(--surface);
    font-weight: 700;
}

.familles button[aria-pressed="true"] { background: var(--encre); border-color: var(--encre); color: #fff; }

.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 10px; }

.tuile {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 118px;
    background: var(--surface);
    border: 1.5px solid var(--trait);
    border-radius: var(--rayon);
    overflow: hidden;
}

.tuile__ajout { flex: 1; display: flex; flex-direction: column; justify-content: flex-start; padding: 12px 12px 8px; border: 0; background: none; text-align: left; }
.tuile__nom { display: block; font-weight: 800; font-size: 1.05rem; line-height: 1.2; }
.tuile__prix { display: block; margin-top: 4px; font-weight: 600; }
.tuile__stock { display: block; font-size: 0.85rem; color: var(--gris); }
.tuile__stock--bas { color: var(--rouge); font-weight: 700; }
.tuile--prise { border-color: var(--vert); border-width: 2.5px; background: var(--vert-clair); }

/* Boutons moins / quantité / plus */
.pas { display: flex; align-items: stretch; border-top: 1.5px solid var(--vert); }

.pas button {
    flex: 1;
    min-width: 46px;
    min-height: 46px;
    border: 0;
    background: var(--vert);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
}

.pas button.pas__demi { background: var(--surface); color: var(--vert); font-size: 1rem; border-left: 1.5px solid var(--vert); }
.pas button.pas__demi[aria-pressed="true"] { background: var(--ambre); color: var(--encre); }
.pas output { flex: 1.3; display: grid; place-items: center; background: var(--surface); font-size: 1.3rem; font-weight: 800; }

.pas--libre { border: 1.5px solid var(--vert); border-radius: var(--rayon); overflow: hidden; max-width: 220px; }

/* Le bon : une feuille de ticket, bord inférieur dentelé comme le papier arraché */
.ticket-cadre { position: sticky; top: calc(var(--barre) + 16px); filter: drop-shadow(0 2px 3px rgba(22, 36, 30, 0.18)); }

.ticket {
    padding: 20px 18px 34px;
    background: #fffef9;
    -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 18px 100%;
    mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 18px 100%;
}

.ticket__titre { font-weight: 800; font-size: 1.15rem; }
.ticket__client { margin-top: 2px; color: var(--gris); }
.ticket__lignes { margin: 14px 0; padding: 12px 0; list-style: none; border-top: 2px dashed var(--trait); border-bottom: 2px dashed var(--trait); max-height: 46vh; overflow-y: auto; }
.ticket__lignes li { display: grid; grid-template-columns: 2.6em 1fr auto; gap: 8px; padding: 4px 0; align-items: baseline; }
.ticket__lignes li b { font-weight: 800; }
.ticket__lignes .ticket__manque { grid-column: 2 / -1; font-size: 0.85rem; color: var(--rouge); font-weight: 700; }
.ticket__total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; font-weight: 800; }
.ticket__total strong { font-size: 1.9rem; }
.ticket__vide { padding: 26px 0; text-align: center; color: var(--gris); }

/* ---------- Caisse : écran d'encaissement ---------- */

.encaisse { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); gap: 24px; align-items: start; }

.du { padding: 18px; border-radius: var(--rayon); background: var(--vert); color: #fff; }
.du span { display: block; font-weight: 600; color: #cfe3d9; }
.du strong { display: block; font-size: 2.6rem; font-weight: 800; line-height: 1.1; }

.recu {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    min-height: 60px;
    padding: 6px 16px;
    border: 2.5px solid var(--encre);
    border-radius: var(--rayon);
    background: var(--surface);
}

.recu span { font-weight: 700; }
.recu strong { font-size: 2.1rem; font-weight: 800; }

.monnaie { padding: 12px 16px; border-radius: var(--rayon); font-size: 1.25rem; font-weight: 800; display: flex; justify-content: space-between; }
.monnaie--rendre { background: var(--vert-clair); color: var(--vert); }
.monnaie--reste { background: var(--ambre-clair); color: #6b4700; }

.pave { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.pave button {
    min-height: 58px;
    border: 1.5px solid var(--trait);
    border-radius: var(--rayon);
    background: var(--surface);
    font-size: 1.6rem;
    font-weight: 800;
}

.pave button:active { background: var(--vert-clair); }
.pave button.pave__efface { font-size: 1.05rem; color: var(--rouge); }

.pile { display: grid; gap: 12px; }

.option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1.5px solid var(--trait);
    border-radius: var(--rayon);
    background: var(--surface);
    font-weight: 700;
}

.option input { width: 26px; height: 26px; accent-color: var(--vert); flex: none; }

/* ---------- Fenêtres de dialogue ---------- */

.dlg {
    width: min(560px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: var(--surface);
    color: var(--encre);
    overflow: hidden;
}

.dlg--large { width: min(880px, calc(100vw - 24px)); }
.dlg::backdrop { background: rgba(22, 36, 30, 0.55); }
.dlg__forme { display: flex; flex-direction: column; max-height: calc(100vh - 24px); }
.dlg__tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 0; }
.dlg__fermer { flex: none; width: 44px; height: 44px; border: 0; border-radius: 8px; background: var(--fond); font-size: 1.5rem; line-height: 1; }
.dlg__corps { padding: 16px 20px; overflow-y: auto; }
.dlg__actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 20px 18px; border-top: 1.5px solid var(--trait); }
.dlg__actions .btn { flex: 1 1 160px; }
.dlg__erreur { margin-bottom: 12px; padding: 10px 14px; border-radius: 8px; background: var(--rouge-clair); color: var(--rouge); font-weight: 700; }

.toasts { position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translateX(-50%); display: grid; gap: 8px; width: min(520px, calc(100vw - 24px)); }
.toast { padding: 14px 18px; border-radius: var(--rayon); background: var(--encre); color: #fff; font-weight: 700; text-align: center; }
.toast--erreur { background: var(--rouge); }

/* ---------- Connexion ---------- */

.entree { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--vert); }
.entree__boite { width: min(560px, 100%); padding: 28px clamp(18px, 5vw, 36px) 32px; border-radius: 16px; background: var(--surface); }
.entree__marque { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; font-size: 1.6rem; font-weight: 800; }
.entree__marque .logo { width: 40px; height: 40px; color: var(--vert); --logo-trou: var(--ambre); }
.entree h1 { margin-bottom: 16px; }
.entree__erreur { margin-bottom: 16px; padding: 12px 14px; border-radius: 8px; background: var(--rouge-clair); color: var(--rouge); font-weight: 700; }
.entree__autre { margin-top: 22px; text-align: center; }

.personnes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

.personnes button {
    min-height: 92px;
    padding: 12px;
    border: 1.5px solid var(--trait);
    border-radius: var(--rayon);
    background: var(--surface);
    text-align: left;
}

.personnes button:hover { border-color: var(--vert); background: var(--vert-clair); }
.personnes strong { display: block; font-size: 1.25rem; }
.personnes span { color: var(--gris); font-size: 0.92rem; }

.code__points { display: flex; justify-content: center; gap: 14px; margin: 6px 0 18px; }
.code__points i { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--encre); }
.code__points i.plein { background: var(--encre); }

/* ---------- Écrans étroits ---------- */

@media (max-width: 980px) {
    .comptoir, .encaisse { grid-template-columns: 1fr; }
    .ticket-cadre { position: static; }
    .ticket__lignes { max-height: none; }
}

@media (max-width: 860px) {
    .barre__menu { display: block; }
    .menu { position: fixed; top: var(--barre); left: 0; z-index: 30; transform: translateX(-105%); transition: transform 0.18s; box-shadow: 4px 0 18px rgba(22, 36, 30, 0.25); }
    .menu.ouvert { transform: none; }
    .barre__nom { display: none; }
    .barre__onglets a { padding: 0 12px; font-size: 1rem; }
    h1 { font-size: 1.45rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ---------- Impression des pages (point du jour) ---------- */

@media print {
    .barre, .menu, .toasts, .page__actions, .onglets, .sans-impression { display: none !important; }
    body { background: #fff; font-size: 11pt; }
    .page { padding: 0; max-width: none; }
    .bloc, .chiffre { border-color: #999; break-inside: avoid; }
}
