/* ===== ACS Tagaza — Style commun ===== */
:root {
  --bleu-acs: #0d0d8f;
  --bleu-acs-fonce: #08085c;
  --bleu-clair: #eef0ff;
  --vert: #1a9e4c;
  --rouge: #d1352b;
  --orange: #e08a1e;
  --gris-texte: #333;
  --gris-fond: #f4f5fa;
  --radius: 10px;
  --ombre: 0 2px 10px rgba(13,13,143,0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--gris-fond);
  color: var(--gris-texte);
  min-height: 100vh;
  display: flex;
}

/* ===== Navigation verticale (sidebar) ===== */
.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--bleu-acs), var(--bleu-acs-fonce));
  color: #fff;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 18px 0 14px;
  display: flex;
  flex-direction: column;
}

.sidebar .logo-bloc {
  text-align: center;
  padding: 0 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.18);
  margin-bottom: 12px;
}
.sidebar .logo-circle {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--bleu-acs);
  font-size: 14px;
  margin: 0 auto 8px;
}
.sidebar h1 { margin: 0; font-size: 0.92rem; line-height: 1.25; }
.sidebar p.sous-titre { margin: 3px 0 0; font-size: 0.68rem; opacity: 0.8; }
.sidebar #sidebar-utilisateur { display: block; margin-top: 8px; font-size: 0.72rem; opacity: 0.9; font-weight: 600; }

#sidebar-liens { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; flex: 1; }
#sidebar-liens a {
  color: #fff; text-decoration: none; font-size: 0.88rem;
  padding: 10px 14px; border-radius: 8px; transition: background 0.12s;
}
#sidebar-liens a:hover { background: rgba(255,255,255,0.14); }
#sidebar-liens a.actif { background: #fff; color: var(--bleu-acs); font-weight: 700; }

.nav-groupe-titre {
  width: 100%; text-align: left; background: none; border: none; color: #fff;
  padding: 10px 14px; font-size: 0.88rem; cursor: pointer; border-radius: 8px;
  display: flex; justify-content: space-between; align-items: center;
  font-family: inherit;
}
.nav-groupe-titre:hover { background: rgba(255,255,255,0.14); }
.nav-groupe .chevron { font-size: 0.65rem; transition: transform 0.15s; }
.nav-groupe.ouvert .chevron { transform: rotate(180deg); }
.nav-sous-menu { display: none; flex-direction: column; padding-left: 12px; }
.nav-groupe.ouvert .nav-sous-menu { display: flex; }
.nav-sous-menu a { font-size: 0.84rem; }

.nav-separateur { border-top: 1px solid rgba(255,255,255,0.18); margin: 10px 14px; }

.contenu-page { flex: 1; min-width: 0; display: flex; flex-direction: column; }

main.acs-main {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* Bascule mobile (sidebar repliable sous une certaine largeur) */
.bouton-menu-mobile { display: none; }
@media (max-width: 820px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; padding: 10px 0; }
  .sidebar .logo-bloc { display: flex; align-items: center; gap: 10px; text-align: left; border-bottom: none; padding: 0 16px; margin-bottom: 0; }
  .sidebar .logo-circle { margin: 0; }
  #sidebar-liens { display: none; padding: 10px; }
  .sidebar.ouvert #sidebar-liens { display: flex; }
  .bouton-menu-mobile {
    display: block; margin-left: auto; margin-right: 14px; background: rgba(255,255,255,0.15);
    color: #fff; border: none; border-radius: 8px; padding: 8px 12px; font-size: 1.1rem; cursor: pointer;
  }
}

/* ===== Menu horizontal (pages publiques : accueil, mon solde, connexion) ===== */
body.disposition-horizontale { display: block; }
header.acs-header {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(120deg, var(--bleu-acs), var(--bleu-acs-fonce));
  color: #fff;
  padding: 16px 24px;
}
header.acs-header .logo-circle {
  width: 48px; height: 48px; border-radius: 50%; background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--bleu-acs); font-size: 14px; flex-shrink: 0;
}
header.acs-header .titres { flex: 1; min-width: 0; }
header.acs-header .titres h1 { margin: 0; font-size: 1.15rem; line-height: 1.25; }
header.acs-header .titres p { margin: 3px 0 0; font-size: 0.8rem; opacity: 0.85; }
header.acs-header nav { display: flex; gap: 8px; flex-wrap: wrap; }
header.acs-header nav a {
  color: #fff; text-decoration: none; font-size: 0.88rem;
  padding: 8px 14px; border-radius: 8px; background: rgba(255,255,255,0.14); transition: background 0.12s;
}
header.acs-header nav a:hover { background: rgba(255,255,255,0.26); }
@media (max-width: 640px) {
  header.acs-header { flex-direction: column; align-items: flex-start; text-align: left; }
  header.acs-header nav { width: 100%; }
}

.carte {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--ombre);
  padding: 22px;
  margin-bottom: 20px;
}

.grille-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.grille-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; }

h2.titre-section {
  color: var(--bleu-acs);
  border-bottom: 2px solid var(--bleu-clair);
  padding-bottom: 8px;
  margin-top: 0;
}

.badge-horaire {
  background: var(--bleu-clair);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.badge-horaire .repas { font-weight: 700; color: var(--bleu-acs-fonce); font-size: 1.05rem; }
.badge-horaire .plage { font-size: 1.4rem; font-weight: 800; margin-top: 6px; color: var(--bleu-acs); }

.bouton {
  display: inline-block;
  background: var(--bleu-acs);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 11px 24px;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}
.bouton:hover { background: var(--bleu-acs-fonce); }
.bouton:active { transform: scale(0.98); }
.bouton.secondaire { background: #fff; color: var(--bleu-acs); border: 1px solid var(--bleu-acs); }
.bouton.vert { background: var(--vert); }
.bouton.vert:hover { background: #157a3b; }
.bouton.rouge { background: var(--rouge); }
.bouton:disabled { opacity: 0.5; cursor: not-allowed; }

input, select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
  margin-top: 6px;
}
label { font-weight: 600; font-size: 0.9rem; color: var(--bleu-acs-fonce); }
.champ { margin-bottom: 16px; }

.alerte { padding: 12px 16px; border-radius: 8px; margin: 12px 0; font-size: 0.92rem; }
.alerte.succes { background: #e6f7ea; color: #157a3b; border: 1px solid #b3e6c1; }
.alerte.erreur { background: #fdecea; color: var(--rouge); border: 1px solid #f6c4c0; }
.alerte.info { background: var(--bleu-clair); color: var(--bleu-acs-fonce); border: 1px solid #cfd4ff; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table th, table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee; }
table th { background: var(--bleu-clair); color: var(--bleu-acs-fonce); }
tr.op-entree td.montant { color: var(--vert); font-weight: 700; }
tr.op-sortie td.montant { color: var(--rouge); font-weight: 700; }

.solde-affiche {
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--bleu-acs);
  text-align: center;
  margin: 10px 0;
}

.stat-tuile {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--ombre);
  padding: 18px;
  text-align: center;
}
.stat-tuile .valeur { font-size: 1.8rem; font-weight: 800; color: var(--bleu-acs); }
.stat-tuile .libelle { font-size: 0.85rem; color: #666; margin-top: 4px; }

.rupture { color: var(--rouge); font-weight: 700; }
.ok-stock { color: var(--vert); font-weight: 600; }

footer.acs-footer {
  text-align: center;
  padding: 20px;
  color: #888;
  font-size: 0.8rem;
}

#lecteur-qr { width: 100%; max-width: 360px; margin: 0 auto; border-radius: var(--radius); overflow: hidden; }

.pastille {
  display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 0.78rem; font-weight: 700;
}
.pastille.debit { background: #dbe6ff; color: var(--bleu-acs-fonce); }
.pastille.recharge { background: #e6f7ea; color: #157a3b; }

/* ===== Mosaïque d'articles (comptoir) ===== */
.mosaique-articles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.tuile-article {
  background: var(--bleu-clair);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, border-color 0.12s, transform 0.08s;
}
.tuile-article:hover { background: #dde3ff; border-color: var(--bleu-acs); }
.tuile-article:active { transform: scale(0.96); }
.tuile-article .nom { font-weight: 700; font-size: 0.88rem; color: var(--bleu-acs-fonce); }
.tuile-article .prix { font-weight: 800; color: var(--bleu-acs); margin-top: 6px; font-size: 0.95rem; }

/* ===== Panier ===== */
.ligne-panier {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 4px; border-bottom: 1px solid #eee; font-size: 0.9rem;
}
.ligne-panier-nom { flex: 1; }
.ligne-panier-qte { display: flex; align-items: center; gap: 8px; margin: 0 12px; }
.btn-qte {
  width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--bleu-acs);
  background: #fff; color: var(--bleu-acs); font-weight: 700; cursor: pointer; line-height: 1;
}
.btn-qte:hover { background: var(--bleu-clair); }
.ligne-panier-total { font-weight: 700; color: var(--bleu-acs-fonce); min-width: 90px; text-align: right; }
.panier-total {
  text-align: right; font-size: 1.15rem; font-weight: 800; color: var(--bleu-acs);
  padding-top: 10px; margin-top: 6px; border-top: 2px solid var(--bleu-clair);
}

/* ===== Gestion des articles (direction) ===== */
.table-articles input[type="text"], .table-articles input[type="number"] { padding: 6px 8px; margin: 0; }
.badge-inactif { color: #999; font-style: italic; }

/* ===== Badges format carte professionnelle (PVC, CR80 : 85.6mm x 53.98mm) ===== */
.grille-badges-pvc { display: flex; flex-wrap: wrap; gap: 18px; justify-content: flex-start; }

.carte-pvc {
  width: 85.6mm; height: 53.98mm;
  background: #fff;
  border: 0.3mm solid #d8d8e8;
  border-radius: 3mm;
  box-shadow: var(--ombre);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: 'Segoe UI', Arial, sans-serif;
  break-inside: avoid;
}

.pvc-entete {
  background: linear-gradient(120deg, var(--bleu-acs), var(--bleu-acs-fonce));
  color: #fff;
  display: flex; align-items: center; gap: 2mm;
  padding: 2mm 3mm;
  flex-shrink: 0;
}
.pvc-logo {
  width: 7mm; height: 7mm; border-radius: 50%; background: #fff; color: var(--bleu-acs);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 2.4mm; flex-shrink: 0;
}
.pvc-entete-texte { min-width: 0; }
.pvc-societe { font-size: 2.5mm; font-weight: 800; letter-spacing: 0.2px; white-space: nowrap; }
.pvc-site { font-size: 1.9mm; opacity: 0.85; white-space: nowrap; }

.pvc-corps { flex: 1; display: flex; align-items: center; gap: 2.5mm; padding: 2.2mm 3mm; min-height: 0; }
.pvc-photo {
  width: 15mm; height: 19mm; border-radius: 1.5mm; overflow: hidden; flex-shrink: 0;
  background: var(--bleu-clair); border: 0.25mm solid #cfd4ff;
  display: flex; align-items: center; justify-content: center;
}
.pvc-photo img { width: 100%; height: 100%; object-fit: cover; }
.pvc-photo .pvc-photo-vide { color: var(--bleu-acs); font-size: 5mm; }

.pvc-infos { flex: 1; min-width: 0; }
.pvc-nom { font-size: 3mm; font-weight: 800; color: var(--bleu-acs-fonce); line-height: 1.15; text-transform: uppercase; }
.pvc-fonction { font-size: 2.3mm; color: #666; margin-top: 0.8mm; }
.pvc-matricule { font-size: 2.5mm; font-weight: 700; color: var(--bleu-acs); margin-top: 1.8mm; }

.pvc-qr { width: 13mm; height: 13mm; flex-shrink: 0; }
.pvc-qr img { width: 100%; height: 100%; }

.pvc-actions-photo { margin-top: 8px; text-align: center; }
.pvc-actions-photo input[type="file"] { display: none; }
.pvc-actions-photo label {
  display: inline-block; font-size: 0.78rem; padding: 5px 12px; border-radius: 14px;
  background: var(--bleu-clair); color: var(--bleu-acs-fonce); cursor: pointer; font-weight: 600;
}
.pvc-actions-photo label:hover { background: #dde3ff; }

@media print {
  .carte-pvc {
    box-shadow: none;
    border: 0.2mm solid #999;
    page-break-after: always;
    break-after: page;
  }
  @page { size: 85.6mm 53.98mm; margin: 0; }
}

/* ===== Ticket de caisse 80mm (fenêtre d'impression dédiée) ===== */
.ticket-80mm {
  width: 72mm;
  margin: 0 auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  color: #000;
  padding: 4mm 2mm;
}
.ticket-80mm .ticket-centre { text-align: center; }
.ticket-80mm .ticket-titre { font-size: 14px; font-weight: 700; }
.ticket-80mm .ticket-separateur { border-top: 1px dashed #000; margin: 6px 0; }
.ticket-80mm .ticket-ligne { display: flex; justify-content: space-between; gap: 6px; }
.ticket-80mm .ticket-total { font-size: 13px; font-weight: 700; }
@page ticket { size: 80mm auto; margin: 0; }
