/* Unifid — panel administrateur. Look SaaS sobre + identité Unifid
   (Fraunces pour la marque, Manrope pour le corps). */
@font-face { font-family: "Fraunces"; src: url("/fonts/fraunces-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/fonts/manrope-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/fonts/manrope-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/fonts/manrope-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --encre: #1b2420;
  --encre-2: #4a5a53;
  --papier: #f5f4f0;
  --carte: #ffffff;
  --bordure: #e4e2db;
  --bordure-forte: #cfccc2;
  --vert: #0f6e56;
  --vert-clair: #1d9e75;
  --danger: #b3341b;
  --sidebar: #17201c;
  --sidebar-txt: #b9c6c0;
  --sidebar-actif: #24332d;
  --rayon: 12px;
  --ombre: 0 1px 2px rgba(20, 30, 26, .06), 0 4px 16px rgba(20, 30, 26, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--encre); background: var(--papier);
  font-size: 15px; line-height: 1.5;
}
[hidden] { display: none !important; }

.marque, .sidebar-marque { display: flex; align-items: center; gap: 10px; font-family: "Fraunces", Georgia, serif; font-weight: 700; font-size: 21px; letter-spacing: -.01em; }
.marque-logo { width: 30px; height: 30px; flex: none; }
.marque-logo text { font-family: "Fraunces", Georgia, serif; }
.login-carte h1 { font-family: "Fraunces", Georgia, serif; }

/* ---------- Connexion ---------- */
.login { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-carte {
  width: 100%; max-width: 400px; background: var(--carte); border: 1px solid var(--bordure);
  border-radius: 16px; box-shadow: var(--ombre); padding: 34px;
  display: flex; flex-direction: column; gap: 14px;
}
.login-carte h1 { font-size: 24px; margin: 8px 0 0; }
.login-intro { color: var(--encre-2); margin: 0 0 6px; }

.champ-label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; color: var(--encre-2); }
.champ {
  font-size: 15px; padding: 11px 13px; border: 1px solid var(--bordure-forte);
  border-radius: 9px; background: #fff; color: var(--encre); width: 100%; font-family: inherit;
}
.champ:focus { outline: none; border-color: var(--vert-clair); box-shadow: 0 0 0 3px rgba(29,158,117,.15); }
.champ-court { max-width: 200px; letter-spacing: 3px; }

/* ---------- Boutons ---------- */
.btn {
  font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 9px;
  padding: 10px 16px; cursor: pointer; transition: background .15s, opacity .15s;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-primaire { background: var(--vert); color: #fff; }
.btn-primaire:hover:not(:disabled) { background: #0c5a46; }
.btn-neutre { background: #fff; color: var(--encre); border-color: var(--bordure-forte); }
.btn-neutre:hover { background: #f0efe9; }
.btn-danger-txt { background: none; border: none; color: var(--danger); cursor: pointer; font: inherit; font-weight: 600; padding: 6px; }
.btn-bloc { width: 100%; padding: 12px; }
.btn-petit { padding: 6px 12px; font-size: 13px; }

.erreur { color: var(--danger); font-weight: 600; margin: 0; font-size: 14px; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100dvh; }
.sidebar {
  background: var(--sidebar); color: var(--sidebar-txt);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100dvh;
}
.sidebar-marque { color: #fff; padding: 0 8px 4px; }
.sidebar-commerce { color: #7f9089; font-size: 13px; padding: 0 8px 16px; border-bottom: 1px solid #24332d; margin-bottom: 10px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  text-align: left; background: none; border: none; color: var(--sidebar-txt);
  font: inherit; font-weight: 500; padding: 10px 12px; border-radius: 8px; cursor: pointer;
}
.nav-item:hover { background: #1e2a25; color: #fff; }
.nav-item.actif { background: var(--sidebar-actif); color: #fff; font-weight: 600; }
.nav-deconnexion { background: none; border: none; color: #7f9089; font: inherit; text-align: left; padding: 10px 12px; cursor: pointer; }
.nav-deconnexion:hover { color: #fff; }

.contenu { padding: 32px 40px; max-width: 1000px; }
.page-tete { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 16px; }
.page-tete h1 { font-size: 26px; margin: 0; letter-spacing: -.01em; }

/* ---------- Cartes / encarts ---------- */
.encart { background: var(--carte); border: 1px solid var(--bordure); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 22px; margin-bottom: 20px; }
.aide { color: var(--encre-2); margin: 0 0 16px; max-width: 60ch; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.stat { background: var(--carte); border: 1px solid var(--bordure); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 18px 20px; }
.stat-val { font-size: 30px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-lib { color: var(--encre-2); font-size: 13px; margin-top: 2px; }

/* ---------- Tableaux ---------- */
.tableau-wrap { background: var(--carte); border: 1px solid var(--bordure); border-radius: var(--rayon); box-shadow: var(--ombre); overflow-x: auto; }
.tableau { width: 100%; border-collapse: collapse; }
.tableau th, .tableau td { text-align: left; padding: 13px 18px; border-bottom: 1px solid var(--bordure); }
.tableau th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--encre-2); background: #faf9f6; font-weight: 700; }
.tableau tr:last-child td { border-bottom: none; }
.tableau tbody tr:hover { background: #faf9f6; }
.vide { padding: 32px 18px; color: var(--encre-2); text-align: center; }

/* Puces d'état */
.puce { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.puce-actif { background: #e4f5ee; color: #0c5a46; }
.puce-inactif { background: #f0efe9; color: var(--encre-2); }

/* Enrôlement : méthodes côte à côte */
.enrol-methodes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 8px 0 4px; }
.enrol-bloc { border: 1px solid var(--bordure); border-radius: var(--rayon); padding: 16px; background: #faf9f6; }
.enrol-bloc h4 { margin: 0 0 6px; font-size: 15px; }
.enrol-bloc .aide { margin: 0 0 12px; font-size: 13px; }
.qr { background: #fff; border: 1px solid var(--bordure); border-radius: 10px; padding: 10px; width: 200px; max-width: 100%; margin: 0 0 12px; }
.qr svg { display: block; width: 100%; height: auto; }
.enrol-token { margin-top: 14px; }
.enrol-token summary { cursor: pointer; color: var(--encre-2); font-size: 13px; }

/* Token révélé une seule fois */
.token-box { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.token-code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; background: #f0efe9; padding: 10px 14px; border-radius: 8px; font-size: 14px; word-break: break-all; flex: 1; min-width: 260px; }

/* Formulaires en ligne */
.ligne-champs { display: flex; gap: 16px; flex-wrap: wrap; }
.ligne-champs .champ-label { flex: 1; min-width: 180px; }
.actions-form { display: flex; gap: 10px; margin-top: 18px; }
.message-inline { font-weight: 600; margin: 0 0 12px; }
.message-ok { color: var(--vert); }
.message-ko { color: var(--danger); }
.radios { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 4px; }
.radio-carte { border: 1px solid var(--bordure-forte); border-radius: 10px; padding: 12px 16px; cursor: pointer; flex: 1; min-width: 200px; }
.radio-carte.choisi { border-color: var(--vert-clair); background: #f2faf7; }
.radio-carte strong { display: block; }
.radio-carte span { color: var(--encre-2); font-size: 13px; }

/* Lignes cliquables + fiche client */
.ligne-cliquable { cursor: pointer; }
.fiche-titre { font-size: 22px; margin: 14px 0 18px; display: flex; align-items: center; gap: 12px; }
.fiche-sous-titre { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--encre-2); margin: 26px 0 10px; }
.fiche-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.fiche-bloc { background: var(--carte); border: 1px solid var(--bordure); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 18px 20px; }
.fiche-bloc h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--encre-2); }
.fiche-bloc dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.fiche-bloc dt { color: var(--encre-2); }
.fiche-bloc dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Encart d'avertissement (marketing) */
.encart-risque { background: #fdf3e7; border-color: #e6c9a0; }
.encart-risque strong { color: #8a5a12; }
textarea.champ { resize: vertical; font-family: inherit; }

/* Bloc anniversaire dans Programme */
.separateur { border: none; border-top: 1px solid var(--bordure); margin: 22px 0; }
.bloc-titre { font-size: 17px; margin: 0 0 6px; }

/* Sélecteur de thème boutique */
.themes-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.theme-carte { display: flex; flex-direction: column; gap: 4px; text-align: left; cursor: pointer;
  background: none; border: 2px solid var(--bordure); border-radius: 12px; padding: 10px; font: inherit; }
.theme-carte:hover { border-color: var(--bordure-forte); }
.theme-carte.choisi { border-color: var(--vert); box-shadow: 0 0 0 3px rgba(15, 110, 86, .14); }
.theme-apercu { display: flex; align-items: center; gap: 8px; height: 66px; border-radius: 9px;
  padding: 0 14px; font-size: 22px; font-weight: 700; position: relative; border: 1px solid rgba(0,0,0,.06); }
.theme-pt { width: 10px; height: 10px; border-radius: 50%; }
.theme-chip { position: absolute; right: 12px; bottom: 12px; width: 34px; height: 10px; border-radius: 999px; }
.theme-nom { font-weight: 700; font-size: 14px; margin-top: 2px; }
.theme-desc { color: var(--encre-2); font-size: 12px; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--encre); color: #fff; padding: 12px 20px; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); font-weight: 600; z-index: 20;
}
.toast.ko { background: var(--danger); }

@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .contenu { padding: 20px; }
}

/* ---------- Bascule connexion / inscription ---------- */
.login-bascule { text-align: center; color: #7a6f60; font-size: 14px; margin: 14px 0 0; }
.login-bascule a { color: #c2562f; font-weight: 600; text-decoration: none; }
.login-bascule a:hover { text-decoration: underline; }

/* ---------- Configuration : sous-onglets ---------- */
.sous-onglets { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 1px solid #e3d8c4; }
.sous-onglet { background: none; border: none; padding: 10px 14px; font: inherit; cursor: pointer; color: #7a6f60; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.sous-onglet:hover { color: #2a2018; }
.sous-onglet.actif { color: #c2562f; border-bottom-color: #c2562f; font-weight: 600; }
.config-tete { margin-bottom: 14px; }

/* ---------- Affiche de caisse (aperçu écran + impression A5) ---------- */
.affiche-cadre { display: flex; justify-content: center; padding: 16px 0; overflow: auto; }
#affiche-poster {
  width: 148mm; min-height: 210mm; padding: 18mm 16mm; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 9mm;
  box-shadow: 0 8px 30px rgba(0,0,0,.18); border-radius: 6px;
}
.af-kicker { font-weight: 700; letter-spacing: .18em; text-transform: uppercase; font-size: 11pt; }
.af-nom { font-size: 34pt; font-weight: 800; line-height: 1.05; }
.af-hero { font-size: 22pt; font-weight: 700; line-height: 1.15; }
.af-etapes { display: flex; flex-direction: column; gap: 6mm; font-size: 13pt; text-align: left; width: 100%; max-width: 112mm; }
.af-etape { display: flex; align-items: center; gap: 12px; }
.af-num { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13pt; }
.af-cta { margin-top: auto; border: 2px solid; border-radius: 12px; padding: 9mm 8mm; font-weight: 800; font-size: 15pt; }

@media print {
  body * { visibility: hidden !important; }
  #affiche-poster, #affiche-poster * { visibility: visible !important; }
  #affiche-poster { position: absolute; top: 0; left: 0; margin: 0; box-shadow: none; border-radius: 0; }
  .sidebar, .toast, #toast { display: none !important; }
  @page { size: A5 portrait; margin: 0; }
}
