/* ===== Back-office Cel'EST Paris — couche mobile (webview) =====
   Shell « app » par-dessus le back-office existant : barre d'onglets en bas,
   écran d'accueil, cartes à la place des tableaux clés, dialogues en feuilles
   plein écran. Tout est confiné derrière la media query 820px : au-delà, le
   bureau ne change pas d'un pixel ; en deçà — téléphone comme fenêtre de
   bureau étroite — c'est le shell mobile qui s'affiche.
   Les éléments mob-* sont injectés par js/mobile.js. */

/* Hors mobile : tout ce que mobile.js injecte reste invisible et neutre. */
#mob-nav, #mob-avatar, #tab-mob-home, #tab-mob-plus, #mob-scan,
.mob-chips, .mob-filtres-btn, .mob-login-foot { display: none; }

@media (max-width: 820px) {

/* ===== Barre du haut compacte ===== */
.topbar { padding: 10px 14px; gap: 10px; }
.topbar img { width: 34px; height: 34px; }
.topbar .brand b { font-size: 13.5px; }
.badge-bo { font-size: 8.5px; padding: 2px 8px; letter-spacing: 2px; }
.topbar .who, .topbar #btn-mon-profil, .topbar #btn-logout { display: none; }
#mob-avatar {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: rgba(241, 181, 29, 0.16); border: 1px solid var(--line-strong);
  color: var(--gold); font-size: 12px; font-weight: 800; cursor: pointer;
  font-family: 'General Sans', sans-serif; padding: 0;
}

/* Les onglets du bureau disparaissent : la navigation passe en bas. */
.tabs { display: none; }

/* ===== Contenu ===== */
.content { padding: 18px 16px calc(110px + env(safe-area-inset-bottom)); }
.toolbar h2 { font-size: 22px; width: 100%; }
.toolbar { gap: 10px; }
.toolbar .spacer { display: none; }
.toolbar .field { width: 100%; }
.toolbar .field input[type="search"] { min-width: 0 !important; width: 100%; }
/* Les longs modes d'emploi du bureau n'ont pas leur place sur un écran de poche. */
#tab-adherents > p.muted, #tab-commandes > p.muted, #tab-moderation .toolbar .muted { display: none; }

/* ===== Barre de navigation basse ===== */
#mob-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; align-items: flex-end;
  background: rgba(36, 6, 13, 0.97); border-top: 1px solid var(--line);
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
}
.mob-nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer; padding: 0;
  color: rgba(255, 247, 230, 0.5); position: relative;
  font-family: 'General Sans', sans-serif;
}
.mob-nav-item span { font-size: 9px; font-weight: 800; letter-spacing: 0.8px; }
.mob-nav-item.active { color: var(--gold); }
.mob-nav-badge {
  position: absolute; top: -6px; right: 14px;
  background: var(--red); color: #fff; font-size: 9px; font-weight: 800;
  border-radius: 8px; padding: 1px 5px;
}
.mob-nav-badge.or { background: var(--gold); color: #160505; }
/* Scanner central surélevé */
.mob-nav-item.scan { flex: 1.15; margin-top: -24px; gap: 5px; color: var(--gold); }
.mob-nav-scanbtn {
  width: 56px; height: 52px;
  background: linear-gradient(135deg, #F1B51D, #d99a06);
  clip-path: polygon(11px 0, 100% 0, calc(100% - 11px) 100%, 0 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 24px rgba(241, 181, 29, 0.45);
}

/* ===== Accueil ===== */
#tab-mob-home:not([hidden]) { display: block; }
.mob-kicker { color: #A67607; font-weight: 800; font-size: 10.5px; letter-spacing: 2.5px; text-transform: uppercase; }
.mob-kicker.or { color: var(--gold); margin: 18px 0 10px; }
.mob-salut { font-size: 26px; margin: 4px 0 16px; }
.mob-salut span { color: var(--gold); }
.mob-afaire { display: flex; flex-direction: column; gap: 10px; }
.mob-carte {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: linear-gradient(160deg, var(--card2), var(--card));
  border: 1px solid var(--line); padding: 14px 16px; cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
  color: var(--cream); font-family: 'General Sans', sans-serif; font-size: 14px;
}
.mob-carte-n {
  width: 38px; height: 38px; flex: none; display: flex; align-items: center; justify-content: center;
  font-family: 'Anton', sans-serif; font-size: 18px;
  background: rgba(241, 181, 29, 0.14); border: 1px solid var(--line-strong); color: var(--gold);
}
.mob-carte-n.rouge { background: rgba(228, 64, 95, 0.14); border-color: rgba(228, 64, 95, 0.5); color: #FF8FA5; }
.mob-carte-txt { flex: 1; min-width: 0; }
.mob-carte-txt b { font-weight: 800; font-size: 14px; display: block; }
.mob-carte-txt small { font-size: 12px; color: var(--cream-45); margin-top: 2px; display: block; }
.mob-carte-chev { color: var(--gold); font-size: 18px; }
.mob-rien { color: var(--cream-45); font-size: 13px; margin: 4px 0; }
.mob-tuiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.mob-tuile {
  background: linear-gradient(160deg, var(--card2), var(--card));
  border: 1px solid var(--line); padding: 13px 15px; text-align: left; cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
  color: var(--cream); font-family: 'General Sans', sans-serif;
}
.mob-tuile small {
  display: block; font-size: 9.5px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--cream-45); font-weight: 800;
}
.mob-tuile b { font-family: 'Anton', sans-serif; font-weight: 400; font-size: 28px; display: block; margin-top: 4px; }
.mob-event {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: linear-gradient(135deg, #5E0F1F, #300811);
  border: 1px solid var(--line); padding: 16px 18px;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
  position: relative; overflow: hidden; color: var(--cream);
  font-family: 'General Sans', sans-serif;
}
.mob-event::before {
  content: ''; position: absolute; right: -30px; top: -30px; width: 130px; height: 130px;
  border-radius: 50%; background: radial-gradient(circle, rgba(241, 181, 29, 0.22), transparent 70%);
}
.mob-event b { font-family: 'Anton', sans-serif; font-weight: 400; font-size: 19px; text-transform: uppercase; letter-spacing: 0.5px; display: block; position: relative; }
.mob-event small { font-size: 12px; color: rgba(255, 247, 230, 0.6); margin-top: 4px; display: block; position: relative; }

/* ===== Écran « Plus » ===== */
#tab-mob-plus:not([hidden]) { display: block; }
.mob-plus-titre { font-size: 23px; margin: 0 0 14px; }
.mob-profil {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(160deg, var(--card2), var(--card));
  border: 1px solid var(--line); padding: 14px 16px;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
}
.mob-avatar-lg {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  background: rgba(241, 181, 29, 0.16); border: 1px solid var(--line-strong);
  color: var(--gold); font-size: 14px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.mob-profil-txt { flex: 1; min-width: 0; }
.mob-profil-txt b { font-size: 14.5px; display: block; }
.mob-role {
  display: inline-block; margin-top: 3px;
  background: rgba(241, 181, 29, 0.16); color: var(--gold);
  font-size: 9px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  padding: 2px 8px; clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
}
.mob-lien { background: none; border: none; color: var(--gold); font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; white-space: nowrap; }
.mob-menu { margin-top: 14px; border: 1px solid var(--line); }
.mob-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: none; border-bottom: 1px solid rgba(241, 181, 29, 0.12);
  padding: 13px 15px; cursor: pointer; color: var(--cream);
  font-family: 'General Sans', sans-serif;
}
.mob-menu-item:last-child { border-bottom: 0; }
.mob-menu-item b { flex: 1; font-weight: 700; font-size: 13.5px; }
.mob-menu-item small { font-size: 11.5px; color: var(--cream-45); }
.mob-menu-item .chev { color: rgba(255, 247, 230, 0.35); }
.mob-logout { display: block; margin: 16px auto 0; background: none; border: none; color: #FF8FA5; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; }

/* ===== Modération : cartes plein écran ===== */
.dossier { padding: 16px; }
.dossier h3 { font-size: 19px; }
.dossier .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
/* E-mail (1), Adresse (3) et Session Stripe (5) sur toute la largeur */
.dossier .grid .kv:nth-child(1), .dossier .grid .kv:nth-child(3), .dossier .grid .kv:nth-child(5) { grid-column: 1 / -1; word-break: break-word; }
.dossier .docs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.dossier .doc { width: 150px; flex: none; }
.dossier .doc .doc-frame { width: 150px; height: 100px; }
.dossier .actions .btn { flex: 1 1 auto; padding: 14px 10px; }

/* ===== Tableaux → cartes (Commandes, Adhérents, Transactions) ===== */
#tab-commandes .table-wrap, #tab-adherents .table-wrap, #tab-transactions .table-wrap { border: none; overflow: visible; }
#tab-commandes table, #tab-adherents table, #tab-transactions table { min-width: 0; display: block; }
#tab-commandes thead, #tab-adherents thead, #tab-transactions thead { display: none; }
#tab-commandes tbody, #tab-adherents tbody, #tab-transactions tbody { display: flex; flex-direction: column; gap: 9px; }
#tab-commandes tbody tr, #tab-adherents tbody tr, #tab-transactions tbody tr {
  background: linear-gradient(160deg, var(--card2), var(--card));
  border: 1px solid var(--line); padding: 13px 14px;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
}
#tab-commandes tbody tr:hover td, #tab-adherents tbody tr:hover td, #tab-transactions tbody tr:hover td { background: none; }
#tab-commandes td:not(.empty), #tab-adherents td:not(.empty), #tab-transactions td:not(.empty) { display: block; padding: 0; border: 0; min-width: 0; white-space: normal !important; text-align: left !important; }
/* Ligne « vide » (colspan) : simple message centré */
#tab-commandes tbody tr:has(> td.empty), #tab-adherents tbody tr:has(> td.empty), #tab-transactions tbody tr:has(> td.empty) {
  display: block; background: none; border: none; clip-path: none; text-align: center;
}
#tab-commandes td.empty, #tab-adherents td.empty, #tab-transactions td.empty {
  display: block; padding: 28px 0; border: 0; text-align: center;
}

/* Commandes — cellules : 1 sel · 2 réf · 3 date · 4 client · 5 articles ·
   6 montant · 7 paiement · 8 encaissé · 9 remise · 10 statut */
#tab-commandes tbody tr:not(:has(> td.empty)) {
  display: grid; align-items: start;
  grid-template-columns: 26px 1fr auto; gap: 3px 10px;
  grid-template-areas: "sel client ref" "sel articles montant" "sel paiement statut" "sel remise remise";
}
#tab-commandes td.sel-cell { grid-area: sel; align-self: center; }
#tab-commandes td:nth-child(2) { grid-area: ref; font-size: 10.5px; color: var(--cream-45); justify-self: end; }
#tab-commandes td:nth-child(2) b { font-weight: 600; }
#tab-commandes td:nth-child(3), #tab-commandes td:nth-child(8) { display: none; }
#tab-commandes td:nth-child(9) { grid-area: remise; font-size: 11px; color: var(--cream-45); }
#tab-commandes td:nth-child(4) { grid-area: client; font-weight: 800; font-size: 14px; word-break: break-word; }
#tab-commandes td:nth-child(5) { grid-area: articles; font-size: 12px; color: rgba(255, 247, 230, 0.55); }
#tab-commandes td:nth-child(6) { grid-area: montant; justify-self: end; font-weight: 700; font-size: 13px; }
#tab-commandes td:nth-child(7) { grid-area: paiement; font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--cream-45); margin-top: 3px; }
#tab-commandes td:nth-child(10) { grid-area: statut; justify-self: end; margin-top: 3px; }

/* Adhérents — cellules : 1 sel · 2 n° · 3 nom · 4 e-mail · 5 tél ·
   6 reçu · 7 statut · 8 actions */
#tab-adherents tbody tr:not(:has(> td.empty)) {
  display: grid; align-items: start;
  grid-template-columns: 26px 1fr auto; gap: 3px 10px;
  grid-template-areas: "sel nom numero" "sel email email" "sel tel statut" "sel actions actions";
}
#tab-adherents td.sel-cell { grid-area: sel; align-self: center; }
#tab-adherents td:nth-child(2) { grid-area: numero; font-size: 11px; color: var(--cream-45); justify-self: end; }
#tab-adherents td:nth-child(3) { grid-area: nom; font-size: 14px; }
#tab-adherents td:nth-child(4) { grid-area: email; font-size: 12.5px; color: rgba(255, 247, 230, 0.6); word-break: break-word; }
#tab-adherents td:nth-child(5) { grid-area: tel; font-size: 12px; color: var(--cream-45); }
#tab-adherents td:nth-child(6) { display: none; }
#tab-adherents td:nth-child(7) { grid-area: statut; justify-self: end; }
#tab-adherents td:nth-child(8) { grid-area: actions; margin-top: 6px; }
#tab-adherents td:nth-child(8) .btn { margin: 0 6px 6px 0; }

/* Transactions — cellules : 1 date · 2 client · 3 montant · 4 statut · 5 moyen · 6 description */
#tab-transactions tbody tr:not(:has(> td.empty)) {
  display: grid; align-items: start;
  grid-template-columns: 1fr auto; gap: 3px 10px;
  grid-template-areas: "client montant" "date statut" "descr descr";
}
#tab-transactions td:nth-child(1):not(.empty) { grid-area: date; font-size: 11.5px; color: var(--cream-45); }
#tab-transactions td:nth-child(2) { grid-area: client; font-size: 13.5px; word-break: break-word; }
#tab-transactions td:nth-child(3) { grid-area: montant; justify-self: end; font-weight: 700; }
#tab-transactions td:nth-child(4) { grid-area: statut; justify-self: end; }
#tab-transactions td:nth-child(5) { display: none; }
#tab-transactions td:nth-child(6) { grid-area: descr; font-size: 12px; color: var(--cream-45); }

/* Cases à cocher : zone de toucher élargie */
.sel-cell input { width: 20px; height: 20px; accent-color: var(--gold); }

/* Autres tableaux : défilement horizontal fluide */
.table-wrap { -webkit-overflow-scrolling: touch; }

/* ===== Filtres repliés + puces de statut (Commandes, Adhérents) ===== */
.mob-chips { display: flex; gap: 7px; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 12px; padding-bottom: 2px; }
.mob-chip {
  flex: none; border: 1px solid rgba(241, 181, 29, 0.35); background: none;
  color: var(--cream-70); font-size: 11px; font-weight: 700; padding: 7px 13px;
  cursor: pointer; font-family: 'General Sans', sans-serif; white-space: nowrap;
}
.mob-chip.active {
  background: var(--gold); color: #160505; font-weight: 800; border-color: var(--gold);
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}
.mob-filtres-btn {
  display: block; width: 100%; background: rgba(11, 3, 2, 0.4);
  border: 1px dashed rgba(241, 181, 29, 0.4); color: var(--cream-70);
  font: 700 12px 'General Sans', sans-serif; letter-spacing: 0.5px;
  padding: 10px; cursor: pointer; text-transform: uppercase;
}
/* Toolbar repliée : on ne garde que le titre, la recherche (.mob-garder,
   classe posée par mobile.js — pas de :has(), absent des vieilles webviews),
   la puce de sélection et le bouton de dépliage. Règles séparées : une liste
   de sélecteurs avec un sélecteur invalide tomberait en bloc. */
.toolbar.mob-repliable:not(.mob-ouverte) > .field:not(.mob-garder) { display: none; }
.toolbar.mob-repliable:not(.mob-ouverte) > .btn { display: none; }
.toolbar.mob-repliable.mob-ouverte .mob-filtres-btn { border-style: solid; color: var(--gold); }
.toolbar.mob-repliable .btn { flex: 1 1 46%; }

/* ===== Dialogues → feuilles plein écran ===== */
dialog {
  position: fixed; inset: auto 0 0 0; margin: 0;
  width: 100%; max-width: 100% !important;
  max-height: calc(100dvh - 36px); overflow-y: auto;
  clip-path: none; border-left: 0; border-right: 0; border-bottom: 0;
  border-top: 1px solid var(--line-strong);
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
  animation: mob-feuille 0.22s ease-out;
}
@keyframes mob-feuille { from { transform: translateY(24px); opacity: 0.5; } to { transform: none; opacity: 1; } }
dialog h2 { font-size: 21px; padding-right: 30px; }
dialog .actions .btn { flex: 1 1 auto; }
/* La croix reste visible pendant le défilement de la feuille (le dialog est
   son propre conteneur de scroll : en absolute, elle partirait avec le haut). */
dialog .dlg-x { position: sticky; float: right; top: 0; margin: -12px -6px 0 0; z-index: 2; }
#cp-voir-frame { height: 55vh; }

/* ===== Toast au-dessus de la barre basse ===== */
#toast {
  bottom: calc(96px + env(safe-area-inset-bottom));
  max-width: calc(100% - 32px); width: max-content; text-align: center;
}

/* ===== Connexion ===== */
.login-wrap { padding: 18px; flex-direction: column; }
.login-card { padding: 34px 26px; }
.mob-login-foot {
  display: block; margin-top: 26px; text-align: center;
  font-size: 10px; letter-spacing: 2px; font-weight: 700; color: rgba(255, 247, 230, 0.3);
}

/* ===== Statistiques / Finance ===== */
.toolbar .periodes { width: 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.periode { flex: none; }
.stats-perso .field { width: calc(50% - 10px); }

/* ===== Scanner (recouvrement plein écran) ===== */
#mob-scan:not([hidden]) { display: flex; }
#mob-scan {
  position: fixed; inset: 0; z-index: 80; flex-direction: column;
  background: #0D0208; color: var(--cream);
}
.mob-scan-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px 8px; }
.mob-scan-head b { font-family: 'Anton', sans-serif; font-weight: 400; font-size: 18px; text-transform: uppercase; letter-spacing: 1px; }
.mob-scan-head b span { color: var(--gold); }
#mob-scan-x { margin-left: auto; background: none; border: none; color: rgba(255, 247, 230, 0.6); font-size: 18px; cursor: pointer; padding: 8px; }
.mob-scan-cam { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; background: radial-gradient(ellipse at 50% 40%, #241018, #0D0208 75%); }
#mob-scan-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mob-scan-vise { position: relative; width: 230px; height: 230px; pointer-events: none; }
.mob-scan-vise i { position: absolute; width: 34px; height: 34px; border: 0 solid var(--gold); }
.mob-scan-vise i:nth-child(1) { top: 0; left: 0; border-top-width: 3px; border-left-width: 3px; }
.mob-scan-vise i:nth-child(2) { top: 0; right: 0; border-top-width: 3px; border-right-width: 3px; }
.mob-scan-vise i:nth-child(3) { bottom: 0; left: 0; border-bottom-width: 3px; border-left-width: 3px; }
.mob-scan-vise i:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px; }
.mob-scan-hint { position: absolute; bottom: 12px; left: 16px; right: 16px; text-align: center; font-size: 11.5px; color: rgba(255, 247, 230, 0.55); }
.mob-scan-bas {
  background: var(--card); border-top: 1px solid var(--line-strong);
  padding: 18px 18px calc(22px + env(safe-area-inset-bottom));
}
.mob-scan-resultat { text-align: center; margin-bottom: 14px; }
.mob-scan-rond {
  width: 52px; height: 52px; margin: 0 auto; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
  background: rgba(111, 207, 111, 0.14); border: 2px solid var(--ok); color: var(--ok);
  box-shadow: 0 0 30px rgba(111, 207, 111, 0.3);
}
.mob-scan-rond.ko { background: rgba(228, 64, 95, 0.14); border-color: var(--red); color: #FF8FA5; box-shadow: 0 0 30px rgba(228, 64, 95, 0.25); }
.mob-scan-verdict { font-weight: 800; font-size: 10.5px; letter-spacing: 2.5px; margin-top: 10px; text-transform: uppercase; color: var(--ok); }
.mob-scan-verdict.ko { color: #FF8FA5; }
.mob-scan-nom { font-family: 'Anton', sans-serif; font-size: 24px; text-transform: uppercase; margin: 4px 0 2px; }
.mob-scan-detail { font-size: 12px; color: rgba(255, 247, 230, 0.5); }
.mob-scan-suivant { width: 100%; margin-top: 14px; padding: 14px 0; }
.mob-scan-manuel { display: flex; gap: 8px; }
.mob-scan-manuel input {
  flex: 1; min-width: 0; font: inherit; font-size: 14.5px; color: var(--cream);
  background: rgba(11, 3, 2, 0.5); border: 1px solid var(--line); padding: 11px 13px;
}
.mob-scan-manuel input:focus { outline: none; border-color: var(--gold-soft); }
.mob-scan-stats { text-align: center; font-size: 11px; color: rgba(255, 247, 230, 0.4); margin: 12px 0 0; }

} /* fin @media 820px */
