/* ============================================================================
   MOULOUDIA MARKET — admin.css
   Comptes (connexion, mon compte) et espace de gestion (admin / vendeur / comptable).
   S'appuie sur les tokens de styles.css.
   ============================================================================ */

/* ---- lien compte dans l'en-tête ---- */
.btn-compte { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--ligne-forte); font-weight: 600; font-size: 14px; color: var(--encre); transition: border-color var(--vite), background var(--vite); }
.btn-compte:hover { border-color: var(--encre); }
.btn-compte svg { width: 18px; height: 18px; }
.btn-compte .avatar { width: 26px; height: 26px; border-radius: 999px; background: var(--rouge); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
@media (max-width: 900px) { .btn-compte .libelle { display: none; } .btn-compte { padding: 0 10px; } }

/* ---- connexion ---- */
.auth { padding: 48px 0 90px; }
.auth-boite { display: grid; grid-template-columns: 1fr 1.2fr; border: 1px solid var(--ligne); border-radius: var(--rayon-lg); overflow: hidden; background: #fff; max-width: 980px; margin: 0 auto; }
.auth-visuel { background: var(--encre); color: #fff; padding: 44px 36px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 14px; position: relative; overflow: hidden; }
.auth-visuel::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 30%, rgba(196,24,20,.28), transparent 60%); pointer-events: none; }
.auth-visuel > * { position: relative; }
.auth-visuel img { width: 150px; margin-bottom: 10px; filter: drop-shadow(0 10px 24px rgba(0,0,0,.45)); }
.auth-visuel .display { font-size: 46px; line-height: .95; color: var(--rouge-vif); }
.auth-visuel .display::after { content: ''; display: block; width: 44px; height: 3px; background: #fff; margin: 14px auto 0; opacity: .6; }
.auth-visuel p:not(.display) { color: rgba(255,255,255,.78); font-size: 14.5px; max-width: 260px; }
.auth-formulaires { padding: 40px 44px; }
.auth-form h1, .auth-form h2.h1 { font-size: 34px; margin-bottom: 18px; }   /* h2.h1 : connexion.html a un titre par onglet (un seul H1 par page) */
.auth-form .champ { margin-bottom: 14px; }
.auth-form .champ .aide { color: var(--gris); font-weight: 400; margin-left: 6px; }
.auth-form .btn { width: 100%; margin-top: 8px; }
.auth-liens { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 13.5px; }
.auth-liens a { color: var(--rouge); text-decoration: underline; text-underline-offset: 3px; }
.btn-social { display: flex; align-items: center; justify-content: center; gap: 12px; height: 50px; border-radius: 999px; border: 1.5px solid var(--ligne-forte); font-weight: 600; font-size: 14.5px; margin-bottom: 10px; transition: background var(--vite), border-color var(--vite); }
.btn-social:hover { background: var(--craie); border-color: var(--encre); }
.btn-social svg { width: 20px; height: 20px; }
.btn-social.facebook { color: #1877F2; }
.auth-ou { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--gris); font-size: 12.5px; }
.auth-ou::before, .auth-ou::after { content: ''; flex: 1; height: 1px; background: var(--ligne); }
.auth-erreur { background: var(--rouge-lavis); color: var(--rouge); padding: 12px 14px; border-radius: var(--rayon); font-size: 14px; margin-bottom: 14px; }
.auth-info { background: var(--ok-lavis); color: var(--ok); padding: 12px 14px; border-radius: var(--rayon); font-size: 14px; margin-bottom: 14px; }
#auth-hors-ligne h1 { font-size: 30px; margin-bottom: 12px; }
#auth-hors-ligne code { background: var(--craie); padding: 2px 6px; border-radius: 3px; }
@media (max-width: 760px) { .auth-boite { grid-template-columns: 1fr; } .auth-visuel { padding: 26px 20px; gap: 8px; } .auth-visuel img { width: 84px; margin-bottom: 4px; } .auth-visuel .display { font-size: 34px; } .auth-visuel .display::after { margin-top: 10px; } .auth-formulaires { padding: 26px 20px; } }

/* ---- mon compte ---- */
.compte { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; padding: 28px 0 80px; align-items: start; }
.compte .bloc { background: #fff; border: 1px solid var(--ligne); border-radius: var(--rayon-lg); padding: 24px; margin-bottom: 18px; }
.compte h2 { font-family: var(--display); text-transform: uppercase; font-size: 26px; margin-bottom: 14px; }
.compte .formulaire { margin-top: 0; }
.liste-commandes .vide { color: var(--gris); }
.liste-commandes .vide a { color: var(--rouge); text-decoration: underline; }
.cmd { border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 14px 16px; margin-bottom: 12px; }
.cmd header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.cmd header .date { color: var(--gris); font-size: 13px; }
.cmd header .statut { margin-left: auto; }
.cmd ul li { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 4px 0; border-bottom: 1px dashed var(--ligne); }
.cmd footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 13.5px; color: var(--encre-2); }
.cmd footer.actions-cmd { justify-content: flex-end; } .cmd .btn.petit { height: 34px; padding: 0 14px; font-size: 13px; }
@media (max-width: 800px) { .compte { grid-template-columns: 1fr; } }

/* ---- pastilles de statut ---- */
.statut { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--craie); color: var(--encre-2); white-space: nowrap; }
.statut::before { content: ''; width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.modif-commande { margin-top: 12px; padding: 12px 14px; border: 1px dashed var(--ligne); border-radius: var(--rayon-lg); background: #fff; }
.modif-commande .tableau td { vertical-align: middle; }
.compteurs button.retours { border-style: dashed; }
.tableau td.articles { font-size: 12px; line-height: 1.35; white-space: nowrap; color: var(--encre-2); }
.compteurs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.compteurs button { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 1px solid var(--ligne); border-radius: 999px; background: #fff; font: inherit; font-size: 13px; cursor: pointer; }
.compteurs button b { font-family: var(--display); font-size: 17px; }
.compteurs button.actif { border-color: var(--encre); background: var(--encre); color: #fff; }
.compteurs button.actif .statut { background: rgba(255,255,255,.18); color: #fff; }
.raccourcis { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: -6px 0 12px; font-size: 12.5px; color: var(--gris); }
.raccourcis button { height: 28px; padding: 0 10px; border: 1px solid var(--ligne); border-radius: 999px; background: #fff; font: inherit; font-size: 12.5px; cursor: pointer; }
.raccourcis button:hover { border-color: var(--encre); }
.exports { display: flex; gap: 8px; flex-wrap: wrap; justify-content: end; margin-bottom: 10px; }
.changer-statut { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-top: 12px; padding: 12px; border: 1px dashed var(--ligne); border-radius: var(--rayon-lg); }
.changer-statut .champ { min-width: 160px; flex: 1; }

/* un champ masqué reste masqué, même si .champ est en flex */
.champ[hidden], .rn-opts[hidden], .formulaire[hidden], section[hidden], p[hidden] { display: none !important; }


/* ---- espace de gestion ---- */
.admin { display: grid; grid-template-columns: 230px 1fr; min-height: calc(100vh - var(--h-entete) - 3px); }
.admin-nav { background: var(--encre); color: #fff; padding: 24px 16px; position: sticky; top: calc(var(--h-entete) + 3px); align-self: start; height: calc(100vh - var(--h-entete) - 3px); overflow: auto; }
.admin-nav .qui { padding: 0 10px 18px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 14px; }
.admin-nav .qui b { display: block; font-weight: 600; }
.admin-nav .qui small { color: rgba(255,255,255,.55); text-transform: uppercase; letter-spacing: .12em; font-size: 10.5px; }
.admin-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--rayon); color: rgba(255,255,255,.8); font-weight: 500; font-size: 14.5px; transition: background var(--vite), color var(--vite); }
.admin-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-nav a.actif { background: var(--rouge); color: #fff; }
.admin-nav a .n { margin-left: auto; background: rgba(255,255,255,.15); border-radius: 999px; padding: 0 8px; font-size: 12px; }
.admin-nav .bas { margin-top: 24px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.12); }
.admin-corps { padding: 28px clamp(16px, 3vw, 40px) 80px; background: var(--craie); min-width: 0; }
.admin-titre { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.admin-titre h1 { font-family: var(--display); text-transform: uppercase; font-size: 34px; line-height: 1; }
.admin-titre .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.carte-admin { background: #fff; border: 1px solid var(--ligne); border-radius: var(--rayon-lg); padding: 20px; margin-bottom: 18px; }
.filtres-admin { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filtres-admin .champ { min-width: 150px; }
.filtres-admin .champ input, .filtres-admin .champ .select { height: 42px; }
.filtres-admin label { font-size: 12px; }

/* tableaux */
.tableau { width: 100%; border-collapse: collapse; font-size: 14px; }
.tableau th, .tableau td { padding: 11px 10px; text-align: left; border-bottom: 1px solid var(--ligne); vertical-align: middle; }
.tableau th { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--gris); font-weight: 600; white-space: nowrap; }
.tableau tbody tr { transition: background var(--vite); }
.tableau tbody tr:hover { background: var(--craie); }
.tableau tr.cliquable { cursor: pointer; }
.tableau .num { font-family: var(--display); font-size: 16px; letter-spacing: .02em; }
.tableau .droite, .tableau .montant { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tableau .montant { font-weight: 600; }
.tableau .muet { color: var(--gris); font-size: 12.5px; }
.tableau tfoot td { font-weight: 700; border-top: 2px solid var(--encre); border-bottom: 0; }
.tableau-scroll { overflow-x: auto; }
.tableau img.vignette { width: 44px; height: 55px; object-fit: cover; border-radius: 4px; background: var(--craie); }

/* tuiles chiffres */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--ligne); border-radius: var(--rayon-lg); padding: 18px 20px; }
.kpi small { display: block; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--gris); font-weight: 600; }
.kpi b { display: block; font-family: var(--display); font-size: 34px; line-height: 1.1; margin-top: 6px; }
.kpi b.rouge { color: var(--rouge); }
.kpi span { font-size: 12.5px; color: var(--encre-2); }

/* panneau latéral (détail commande / fiche produit / utilisateur) */
.panneau { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: #fff; z-index: 80; transform: translateX(100%); transition: transform var(--moyen) var(--ease-out); display: flex; flex-direction: column; box-shadow: -20px 0 60px -30px rgba(20,12,13,.4); }
.panneau.ouvert { transform: none; }
.panneau-entete { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--ligne); }
.panneau-entete h2 { font-family: var(--display); text-transform: uppercase; font-size: 24px; }
.panneau-corps { padding: 20px 22px; overflow: auto; flex: 1; }
.panneau-pied { padding: 14px 22px; border-top: 1px solid var(--ligne); background: var(--craie); display: flex; gap: 10px; flex-wrap: wrap; }
.panneau .formulaire { margin-top: 0; }
.panneau .section-titre { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--gris); font-weight: 600; margin: 18px 0 8px; }
.fiche-infos { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 14px; }
.fiche-infos dt { color: var(--gris); }
.fiche-infos dd { margin: 0; font-weight: 500; }
.historique { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.historique li { padding: 8px 0; border-bottom: 1px dashed var(--ligne); display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.historique li small { color: var(--gris); }
.etapes-statut { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.etapes-statut .btn { height: 40px; padding: 0 14px; font-size: 13px; }
.btn.danger { border-color: var(--rouge); color: var(--rouge); }
.btn.danger:hover { background: var(--rouge); color: #fff; }
.btn.ok { background: var(--ok); color: #fff; }
.chips-tailles { display: flex; gap: 8px; flex-wrap: wrap; }
.chips-tailles label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--ligne-forte); border-radius: 999px; font-size: 13px; cursor: pointer; }
.chips-tailles input { accent-color: var(--rouge); }
.images-produit { display: flex; gap: 10px; flex-wrap: wrap; }
.images-produit figure { margin: 0; width: 118px; display: flex; flex-direction: column; gap: 4px; }
.images-produit img { width: 118px; height: 148px; object-fit: cover; border-radius: 4px; border: 1px solid var(--ligne); }
.images-produit figure:first-child img { border-color: var(--rouge); box-shadow: 0 0 0 2px var(--rouge); }
.images-produit figcaption { display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; line-height: 1.3; }
.images-produit .principale { color: var(--rouge); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.images-produit .lien { background: none; border: 0; padding: 0; font: inherit; font-size: 11.5px; color: var(--encre-2); text-decoration: underline; cursor: pointer; text-align: left; }
.images-produit .lien.danger { color: var(--rouge); }
.images-produit .select.petit { height: 30px; padding: 0 26px 0 8px; font-size: 11.5px; width: 100%; }
.images-produit .select.petit::after { right: 9px; width: 6px; height: 6px; }
.role-badge { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; padding: 3px 8px; border-radius: 4px; background: var(--craie); }
.role-admin { background: var(--encre); color: #fff; } .role-vendeur { background: var(--rouge-lavis); color: var(--rouge); } .role-comptable { background: var(--ok-lavis); color: var(--ok); }
.inactif { opacity: .5; }
.actions-rapides { white-space: nowrap; } .actions-rapides .btn { margin: 2px 4px 2px 0; height: 30px; padding: 0 10px; font-size: 12px; }
.vide-admin { padding: 40px; text-align: center; color: var(--gris); }
.copie-lien { font-family: monospace; font-size: 12px; background: var(--craie); padding: 8px 10px; border-radius: 4px; word-break: break-all; }

/* menu mobile de l'admin */
.admin-burger { display: none; }
@media (max-width: 900px) {
  .admin { grid-template-columns: 1fr; }
  .admin-nav { position: static; height: auto; display: flex; gap: 6px; overflow-x: auto; padding: 12px; }
  .admin-nav .qui, .admin-nav .bas { display: none; }
  .admin-nav a { white-space: nowrap; padding: 8px 12px; }
  .admin-nav a .n { margin-left: 6px; }
  .kpi b { font-size: 28px; }
  .admin-corps { padding: 16px 12px 60px; }
  .filtres-admin { gap: 8px; }
  .filtres-admin .champ { min-width: calc(50% - 4px); flex: 1; }
  .filtres-admin .champ[style*="flex:1"] { min-width: 100%; }
  .filtres-admin .btn { flex: 1; }
  .tableau-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -6px; padding: 0 6px; }
  .tableau-scroll .tableau { min-width: 640px; }
  .admin-titre { flex-wrap: wrap; gap: 10px; }
  .admin-titre h1 { font-size: 30px; }
  .panneau { width: 100%; }
  .panneau-pied { flex-wrap: wrap; }
  .panneau-pied .btn { flex: 1; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .etat { padding: 18px 14px; }
  .etat-entete { grid-template-columns: auto 1fr; }
  .etat-entete .meta { grid-column: 1 / -1; text-align: left; }
  .etat-signatures { grid-template-columns: 1fr; }
}

/* ---- ÉTATS À IMPRIMER (pièces justificatives) ---- */
.etat { background: #fff; border: 1px solid var(--ligne); border-radius: var(--rayon-lg); padding: 28px 32px; max-width: 900px; }
.etat-entete { display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center; border-bottom: 3px solid var(--rouge); padding-bottom: 16px; margin-bottom: 18px; }
.etat-entete img { height: 64px; }
.etat-entete .etat-club b { display: block; font-family: var(--display); font-size: 22px; text-transform: uppercase; line-height: 1; }
.etat-entete .etat-club small { color: var(--gris); }
.etat-entete .meta { text-align: right; font-size: 12.5px; line-height: 1.6; }
.etat-entete .meta b { font-family: var(--display); font-size: 18px; display: block; }
.etat h2 { font-family: var(--display); text-transform: uppercase; font-size: 26px; margin-bottom: 4px; }
.etat .periode { color: var(--encre-2); margin-bottom: 16px; }
.etat h3 { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--gris); margin: 22px 0 8px; }
.etat .total-general { display: flex; justify-content: space-between; align-items: baseline; margin-top: 18px; padding-top: 12px; border-top: 2px solid var(--encre); font-weight: 700; }
.etat .total-general b { font-family: var(--display); font-size: 30px; color: var(--rouge); }
.etat-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 36px; font-size: 13px; }
.etat-signatures div { border-top: 1px solid var(--encre); padding-top: 8px; min-height: 90px; }
.etat-signatures small { color: var(--gris); }
.etat-actions { display: flex; gap: 10px; margin: 0 0 16px; }
@media print {
  body { background: #fff; }
  .entete, .menu-mobile, .admin-nav, .admin-titre, .filtres-admin, .etat-actions, .pied, .bandeau-preprod, .tiroir, .voile, .toast, .panneau, .kpis, .carte-admin:not(.etat) { display: none !important; }
  .admin { display: block; }
  .admin-corps { padding: 0; background: #fff; }
  .etat { border: 0; padding: 0; max-width: none; }
  .tableau th, .tableau td { padding: 6px 8px; font-size: 12px; }
  @page { margin: 14mm; }
}

/* ---- 18/09/2026 : une couleur par statut, la même partout (pastille, bord gauche de la ligne, compteur) ----
   rouge = à traiter · bleu = prêt pour l'appel · orange = à rappeler · jaune = en attente du client · violet = confirmée
   indigo = en préparation / chez le livreur · cyan = expédiée / article récupéré · vert = livrée / clôturée / encaissée · gris = annulée */
[data-statut="nouvelle"], [data-rstatut="demandee"]       { --st: #C41814; }
[data-statut="a_appeler"]                                  { --st: #1B4F9C; }
[data-statut="a_rappeler"]                                 { --st: #C2620A; }
[data-statut="en_attente"]                                 { --st: #A07D00; }
[data-statut="confirmee"], [data-rstatut="acceptee"]       { --st: #6A35A8; }
[data-statut="preparation"], [data-rstatut="en_livraison"] { --st: #3446A8; }
[data-statut="expediee"], [data-rstatut="recue"]           { --st: #0F6C8C; }
[data-statut="livree"], [data-rstatut="traitee"]           { --st: #1E7A3C; }
[data-statut="annulee"], [data-rstatut="annulee"]          { --st: #7A7A7A; }
[data-rstatut="refusee"]                                   { --st: #7A2E2E; }
.s-nouvelle, .s-demandee       { background: #FDE8E7; color: #C41814; }
.s-a_appeler                   { background: #E6F0FB; color: #1B4F9C; }
.s-rupture                     { background: #FDE8E7; color: #C41814; }
.s-doublon                     { background: #FFE3CC; color: #A34700; }
.compteurs button.doublons { border-style: dashed; }
.compteurs button.doublons.alerte { border-style: solid; border-color: #A34700; }
.compteurs button.doublons.alerte b { color: #A34700; }
.compteurs button.doublons.actif { background: #A34700; border-color: #A34700; color: #fff; }
.compteurs button.doublons.actif b { color: #fff; }
.alerte-doublon { border: 1.5px solid #E8A36B; background: #FFF4EA; border-radius: var(--rayon-lg); padding: 14px 16px; margin-bottom: 16px; font-size: 14px; }
.alerte-doublon b { color: #A34700; }
.alerte-doublon p { margin-top: 6px; }
.alerte-doublon a, .historique a { color: var(--rouge); text-decoration: underline; text-underline-offset: 3px; }
.p-stock.rupture { border-color: #C41814 !important; color: #C41814; font-weight: 700; }
.s-a_rappeler                  { background: #FFEBD6; color: #B85A00; }
.s-en_attente                  { background: #FFF6CC; color: #8A6A00; }
.s-confirmee, .s-acceptee      { background: #EFE6FA; color: #6A35A8; }
.s-preparation, .s-en_livraison { background: #E9ECFF; color: #3446A8; }
.s-expediee, .s-recue          { background: #E0F4FA; color: #0F6C8C; }
.s-livree, .s-traitee, .s-encaissee, .s-regularisee { background: #E3F5E8; color: #1E7A3C; }
.s-annulee, .s-sans_objet      { background: #EFEFEF; color: #6F6F6F; }
.s-refusee                     { background: #F3E5E5; color: #7A2E2E; }
.s-a_encaisser, .s-a_regulariser { background: #FFF1D6; color: #9A5B00; }
.tableau tr[data-statut] td:first-child, .tableau tr[data-rstatut] td:first-child { box-shadow: inset 4px 0 0 var(--st, transparent); }
.compteurs button[data-statut]:not([data-statut=""]) { border-color: var(--st); }
.compteurs button[data-statut]:not([data-statut=""]) b { color: var(--st); }
.compteurs button.actif { border-color: var(--st, var(--encre)); background: var(--st, var(--encre)); color: #fff; }
.compteurs button.actif b { color: #fff; }
.etapes-statut .btn.plein[data-statut] { background: var(--st, var(--rouge)); border-color: var(--st, var(--rouge)); }
