/* Style Principal KLIPP - Dark Theme */
/* Charte « verre dépoli bleu nuit » : fond profond dégradé, panneaux translucides,
   bords adoucis. La couleur d'accent reste pilotée depuis l'administration. */
/* Deux palettes, un seul jeu de variables. Aucune regle plus bas ne connait de
   couleur en dur : changer de theme ne demande donc de toucher qu'a ce bloc.
   Le theme clair est celui par defaut ; le sombre reste accessible d'un bouton. */
:root {
  color-scheme: light;
  --bg-dark: #f5f7fc;
  --bg-deep: #eceff8;
  --bg-panel: rgba(255, 255, 255, 0.92);
  --bg-input: #ffffff;
  --accent: #6c5ce7;
  --accent-hover: #5a4bcf;
  --text: #1a2133;
  --text-muted: #5b6478;
  --border: rgba(26, 33, 51, 0.10);
  --border-fort: rgba(26, 33, 51, 0.17);
  --success: #00a97e;
  --ombre: 0 10px 30px rgba(23, 32, 58, 0.10);

  --fond-page:
    radial-gradient(1100px 620px at 12% -8%, rgba(108, 92, 231, 0.10), transparent 62%),
    radial-gradient(900px 560px at 92% 6%, rgba(0, 168, 232, 0.07), transparent 58%),
    linear-gradient(160deg, #fbfcff 0%, var(--bg-deep) 100%);
  --fond-rail: linear-gradient(180deg, #ffffff, #f7f9fe);
  --fond-connexion:
    radial-gradient(900px 520px at 20% 0%, rgba(108, 92, 231, 0.16), transparent 60%),
    radial-gradient(760px 480px at 85% 12%, rgba(0, 168, 232, 0.10), transparent 58%),
    linear-gradient(160deg, #f7f9ff 0%, #e9edf8 100%);
  --plan-fond: #ffffff;
  --plan-grille: rgba(26, 33, 51, 0.055);
  --flou: none;
  /* La carte de connexion a sa propre surface : en clair, elle doit rester une
     carte blanche posee sur un fond pale, sinon son texte sombre disparait. */
  --carte-connexion: rgba(255, 255, 255, 0.94);
  --carte-reflet: rgba(255, 255, 255, 0.6);
  --voile-doux: rgba(26, 33, 51, 0.05);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg-dark: #0f1729;
  --bg-deep: #0a0f1e;
  --bg-panel: rgba(24, 35, 58, 0.72);
  --bg-input: rgba(13, 21, 38, 0.78);
  --text: #eaf0ff;
  --text-muted: #8fa3c8;
  --border: rgba(126, 154, 208, 0.18);
  --border-fort: rgba(126, 154, 208, 0.32);
  --success: #00d09c;
  --ombre: 0 18px 44px rgba(0, 0, 0, 0.45);

  --fond-page:
    radial-gradient(1100px 620px at 12% -8%, rgba(108, 92, 231, 0.20), transparent 62%),
    radial-gradient(900px 560px at 92% 6%, rgba(0, 168, 232, 0.14), transparent 58%),
    linear-gradient(160deg, #101a30 0%, var(--bg-deep) 58%, #070b16 100%);
  --fond-rail: linear-gradient(180deg, rgba(22, 33, 56, 0.86), rgba(14, 22, 40, 0.86));
  --fond-connexion:
    radial-gradient(900px 520px at 20% 0%, rgba(108, 92, 231, 0.26), transparent 60%),
    radial-gradient(760px 480px at 85% 12%, rgba(0, 168, 232, 0.18), transparent 58%),
    linear-gradient(160deg, #121d36 0%, #080d1a 100%);
  --plan-fond: #181824;
  --plan-grille: rgba(143, 163, 200, 0.07);
  --flou: blur(18px);
  --carte-connexion: rgba(23, 34, 58, 0.66);
  --carte-reflet: rgba(255, 255, 255, 0.09);
  --voile-doux: rgba(143, 163, 200, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', sans-serif; }

body {
  display: flex; height: 100vh; color: var(--text); overflow: hidden;
  background: var(--fond-page);
}

/* Sidebar UI */
.sidebar {
  width: 350px; padding: 20px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto;
  background: var(--fond-rail);
  border-right: 1px solid var(--border);
  backdrop-filter: var(--flou); -webkit-backdrop-filter: var(--flou);
}
.brand { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.brand-nom { font-size: 21px; font-weight: 800; letter-spacing: -0.4px; color: var(--text); }
.brand-nom em { font-style: normal; font-weight: 400; color: var(--accent); margin-left: 5px; }
.brand-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  background: var(--voile-doux); border: 1px solid var(--border); color: var(--text-muted);
  width: 30px; height: 30px; border-radius: 9px; cursor: pointer; font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center; transition: all .15s; padding: 0;
}
.icon-btn:hover { color: #ff8b8a; border-color: rgba(255, 139, 138, .5); background: rgba(255, 139, 138, .1); }

/* Sélecteur de module */
.module-switch { display: flex; gap: 7px; flex-wrap: wrap; }
.module-btn {
  flex: 1; min-width: 108px; padding: 11px 9px; border-radius: 11px; cursor: pointer;
  font-size: 12px; font-weight: 600; transition: all .15s;
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text-muted);
}
.module-btn:hover { color: var(--text); border-color: var(--accent); }
.module-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px rgba(108, 92, 231, .30);
}

/* Sélecteurs de couleur du module maillot */
.color-input { width: 46px; height: 38px; padding: 3px; cursor: pointer; flex: 0 0 auto;
               background: var(--bg-input); border: 1px solid var(--border); border-radius: 9px; }
#modulePanel select { width: 100%; padding: 9px 11px; background: var(--bg-input);
                      border: 1px solid var(--border); border-radius: 9px; color: var(--text); font-size: 13px; }
#modulePanel select:disabled { opacity: .6; }

/* Annuler / Rétablir */
.history-bar { display: flex; gap: 8px; }
.history-bar .btn { font-size: 12px; padding: 9px 10px; }

.badge-status {
  font-size: 10px; padding: 4px 10px; border-radius: 20px; font-weight: 600; letter-spacing: .6px;
  background: var(--voile-doux); color: var(--text-muted); border: 1px solid var(--border);
}
.badge-status.pro {
  background: linear-gradient(135deg, var(--success), #00b894);
  color: #04231c; border-color: transparent; font-weight: 800;
  box-shadow: 0 0 16px rgba(0, 208, 156, 0.34);
}

.section-title { font-size: 11px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 1.3px; font-weight: 700; margin-bottom: 9px; opacity: .85; }

.group {
  display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 14px;
  background: var(--bg-panel); border: 1px solid var(--border);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 var(--carte-reflet);
}

label { font-size: 13px; display: flex; justify-content: space-between; align-items: center; color: var(--text-muted); }
input[type="number"], input[type="file"], input[type="text"] {
  width: 100%; padding: 9px 11px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 9px; color: var(--text); font-size: 13px; transition: border-color .15s, box-shadow .15s;
}
input[type="number"]:focus, input[type="text"]:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.18);
}
input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }

/* Ecran de connexion unifie */
.login-screen {
  position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: var(--fond-connexion);
}
.login-screen.masque { display: none; }

.login-card {
  width: 100%; max-width: 380px; padding: 34px 30px 28px; border-radius: 22px; text-align: center;
  background: var(--carte-connexion); border: 1px solid var(--border-fort);
  backdrop-filter: blur(26px); -webkit-backdrop-filter: blur(26px);
  box-shadow: var(--ombre), inset 0 1px 0 var(--carte-reflet);
}
.login-brand { font-size: 30px; font-weight: 800; letter-spacing: -1px; }
.login-brand span { font-weight: 300; color: var(--accent); margin-left: 7px; }
.login-sub { font-size: 12.5px; color: var(--text-muted); margin: 7px 0 24px; line-height: 1.5; }

.login-block { display: flex; flex-direction: column; gap: 9px; text-align: left; margin-bottom: 11px; }
.login-block label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.login-block input { text-align: center; font-family: monospace; font-size: 15px; letter-spacing: 1.2px; padding: 12px; }

.login-sep { display: flex; align-items: center; gap: 12px; margin: 22px 0 16px; color: var(--text-muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px; }
.login-sep::before, .login-sep::after { content: ''; flex: 1; height: 1px; background: var(--border-fort); }
.login-google { display: flex; justify-content: center; min-height: 44px; }
.login-aide { font-size: 11px; color: var(--text-muted); line-height: 1.5; margin-top: 11px; opacity: .85; }

.login-msg { margin-top: 15px; font-size: 12.5px; color: var(--text-muted); min-height: 18px; line-height: 1.45; }
.login-msg.erreur { color: #ff8b8a; }
.login-msg.succes { color: var(--success); }

.btn-ghost { background: transparent; border: 1px solid var(--border-fort); color: var(--text-muted); }
.btn-ghost:hover { background: var(--voile-doux); color: var(--text); }

/* Avertissement du mode demo */
.demo-notice {
  display: none; font-size: 11.5px; line-height: 1.5; padding: 10px 12px; border-radius: 10px;
  color: #8a5a00; background: rgba(255, 176, 80, 0.16); border: 1px solid rgba(255, 176, 80, 0.45);
}

/* Galerie de masques */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { flex: 1; min-width: 78px; background: var(--bg-input); border: 1px solid var(--border); color: var(--text-muted); padding: 7px 6px; border-radius: 6px; cursor: pointer; font-size: 11px; transition: all 0.15s; }
.tab:hover { color: var(--text); border-color: var(--accent); }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.mask-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-height: 260px; overflow-y: auto; padding: 2px; }
.gallery-empty { grid-column: 1 / -1; font-size: 12px; color: var(--text-muted); text-align: center; padding: 18px 8px; line-height: 1.5; }

.mask-card { position: relative; background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; padding: 8px 6px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px; transition: all 0.15s; }
.mask-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.mask-card img { width: 44px; height: 44px; object-fit: contain; pointer-events: none; }
.card-label { font-size: 10px; color: var(--text-muted); text-align: center; line-height: 1.2; word-break: break-word; }
.thumb-missing { background: var(--border); border-radius: 4px; opacity: 0.4; }

/* Masque PRO non debloque : l'apercu reste visible, la forme vectorielle non */
.mask-card.locked img { opacity: 0.35; }
.mask-card.locked .card-label { opacity: 0.5; }
.card-lock { position: absolute; top: 4px; right: 4px; background: var(--accent); color: #fff; font-size: 8px; font-weight: bold; padding: 2px 4px; border-radius: 3px; letter-spacing: 0.5px; }
.card-del { position: absolute; top: 2px; right: 3px; background: transparent; border: none; color: var(--text-muted); font-size: 16px; line-height: 1; cursor: pointer; padding: 2px 4px; }
.card-del:hover { color: #ff7675; }

.import-label { margin-top: 4px; }

/* Saisie des dimensions reelles */
.dim-block { display: flex; flex-direction: column; gap: 5px; }
.dim-title { font-size: 12px; color: var(--text-muted); }
.dim-row { display: flex; align-items: center; gap: 6px; }
.dim-row input { flex: 1; min-width: 0; }
.dim-sep { color: var(--text-muted); font-size: 13px; }
.lock-btn { flex: 0 0 auto; width: 38px; padding: 8px 0; background: var(--bg-input); border: 1px solid var(--border);
            border-radius: 6px; cursor: pointer; font-size: 14px; line-height: 1; transition: all 0.15s; }
.lock-btn:hover { border-color: var(--accent); }
.lock-btn.active { background: var(--accent); border-color: var(--accent); }
.dim-row select { width: 100%; padding: 8px 10px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 13px; }
.orient-row { gap: 6px; }
.orient-btn { flex: 1; background: var(--bg-input); border: 1px solid var(--border); color: var(--text-muted); padding: 7px; border-radius: 6px; cursor: pointer; font-size: 11px; transition: all 0.15s; }
.orient-btn:hover { color: var(--text); border-color: var(--accent); }
.orient-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.hint { font-size: 11px; color: var(--text-muted); line-height: 1.45; margin-bottom: 2px; }
.btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
/* Logo personnalise, en remplacement du texte KLIPP */
.brand-logo { max-height: 30px; max-width: 190px; object-fit: contain; display: block; }

/* Creations enregistrees */
.projet-liste { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; margin-top: 4px; }
.projet-card { position: relative; display: flex; align-items: center; gap: 9px; padding: 7px 26px 7px 8px;
               background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px;
               cursor: pointer; transition: all 0.15s; }
.projet-card:hover { border-color: var(--accent); }
.projet-card.courant { border-color: var(--accent); background: rgba(108, 92, 231, 0.12); }
.projet-card img { width: 34px; height: 34px; object-fit: cover; border-radius: 4px; flex: 0 0 auto; }
.projet-nom { font-size: 12px; color: var(--text); flex: 1; min-width: 0; overflow: hidden;
              text-overflow: ellipsis; white-space: nowrap; }
.projet-date { font-size: 10px; color: var(--text-muted); flex: 0 0 auto; }

.btn-danger { color: #ff7675; }
.btn-danger:hover { border-color: #ff7675; background: rgba(255, 118, 117, 0.08); }

.btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff; border: none; padding: 11px 15px; border-radius: 10px; font-weight: 700;
  cursor: pointer; font-size: 13px; width: 100%;
  transition: transform .12s, box-shadow .18s, filter .18s;
  box-shadow: 0 6px 18px rgba(108, 92, 231, 0.28);
}
.btn:hover { filter: brightness(1.08); box-shadow: 0 8px 24px rgba(108, 92, 231, 0.40); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; box-shadow: none; }
.btn-secondary { background: rgba(143, 163, 200, 0.07); border: 1px solid var(--border); color: var(--text); box-shadow: none; font-weight: 600; }
.btn-secondary:hover { background: rgba(143, 163, 200, 0.14); border-color: var(--border-fort); filter: none; box-shadow: none; }

/* Canvas Area */
.canvas-wrapper { flex: 1; display: flex; justify-content: center; align-items: center; position: relative; }

/* Indicateur de taille du plan de travail.
   Volontairement hors du canvas : un objet Fabric aurait pu se glisser dans un export,
   un element HTML en est incapable par construction. */
.size-badge {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  background: rgba(30, 30, 44, 0.9); border: 1px solid var(--border); border-radius: 20px;
  padding: 6px 14px; font-size: 11px; color: var(--text-muted); white-space: nowrap;
  pointer-events: none;      /* ne doit jamais intercepter un geste sur le plan */
  z-index: 5; max-width: calc(100% - 24px);
}
.size-badge .badge-format { color: var(--accent); font-weight: 700; letter-spacing: .3px; }
.size-badge .badge-sep { opacity: .35; }
.size-badge .badge-px { font-variant-numeric: tabular-nums; }
.size-badge:empty { display: none; }

@media (max-width: 560px) {
  .size-badge { top: 6px; font-size: 10px; padding: 4px 10px; gap: 5px; }
}
canvas { border-radius: 12px; box-shadow: 0 22px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--border); }

/* License Modal */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.8); justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: var(--bg-panel); padding: 25px; border-radius: 10px; width: 360px; max-width: calc(100vw - 32px); border: 1px solid var(--border); text-align: center; }

/* ------------------------------------------------------------------ Mobile
   En dessous de 900 px, la mise en page cote a cote devient inutilisable :
   le panneau de 350 px occuperait presque tout l'ecran. On empile donc, en
   gardant le plan de travail visible en permanence pendant qu'on fait defiler
   les reglages : sans cela, on regle un masque qu'on ne voit pas. */
@media (max-width: 900px) {
  body { flex-direction: column; height: auto; min-height: 100vh; overflow-y: auto; }

  .canvas-wrapper {
    order: -1;                 /* le plan de travail passe au-dessus des reglages */
    width: 100%;
    min-height: 46vh;
    padding: 12px;
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--border);
  }

  .sidebar {
    width: 100%;
    border-right: none;
    overflow-y: visible;
    padding: 16px 14px 40px;
  }

  /* Empeche le defilement de la page de voler le geste de manipulation du masque. */
  canvas { touch-action: none; max-width: 100%; }

  .mask-gallery { grid-template-columns: repeat(4, 1fr); max-height: none; }
  .mask-card img { width: 40px; height: 40px; }

  /* Cibles tactiles : 44 px est le minimum confortable au doigt. */
  .btn, .tab, .orient-btn { min-height: 44px; }
  .dim-row input, .dim-row select, input[type="number"], input[type="text"] { min-height: 44px; font-size: 16px; }
  /* 16 px evite le zoom automatique de Safari a la mise au point d'un champ. */
}

@media (max-width: 560px) {
  .mask-gallery { grid-template-columns: repeat(3, 1fr); }
  .tabs { gap: 3px; }
  .tab { min-width: 0; font-size: 10px; padding: 8px 3px; }
  .canvas-wrapper { min-height: 40vh; padding: 8px; }
  .sidebar { padding: 14px 10px 40px; }
}

/* Scène de la bibliothèque — occupe toute la zone principale */
.library-stage {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  padding: 22px 26px; gap: 16px; overflow: hidden;
}
.library-stage[hidden] { display: none; }

.lib-barre {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 12px 16px; border-radius: 14px;
  background: var(--bg-panel); border: 1px solid var(--border);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.lib-barre select {
  padding: 9px 12px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 9px; color: var(--text); font-size: 13px; min-width: 175px;
}
.lib-barre .lib-titre { font-size: 15px; font-weight: 700; margin-right: auto; }
.lib-barre .lib-compte { font-size: 12px; color: var(--text-muted); }

.lib-grille {
  flex: 1; overflow-y: auto; display: grid; gap: 16px; align-content: start;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  padding: 2px 2px 20px;
}

.lib-carte {
  position: relative; background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px; cursor: pointer; transition: all .16s;
  display: flex; flex-direction: column; gap: 9px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.lib-carte:hover { border-color: var(--accent); transform: translateY(-2px);
                   box-shadow: 0 12px 28px rgba(0,0,0,.34); }
.lib-carte img {
  width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 9px;
  background: rgba(255,255,255,.05);
}
.lib-carte .lib-nom { font-size: 12.5px; font-weight: 600; line-height: 1.3; word-break: break-word; }
.lib-carte .lib-meta { font-size: 10.5px; color: var(--text-muted); }

.lib-carte.locked img { opacity: .38; filter: grayscale(.5); }
.lib-carte.locked .lib-nom { opacity: .6; }
.lib-verrou {
  position: absolute; top: 9px; right: 9px; padding: 3px 8px; border-radius: 20px;
  font-size: 9px; font-weight: 800; letter-spacing: .5px;
  background: linear-gradient(135deg, #f7971e, #ffd200); color: #3a2a00;
}
.lib-verrou.pro { background: var(--accent); color: #fff; }

.lib-vide { grid-column: 1/-1; text-align: center; color: var(--text-muted);
            font-size: 13px; padding: 60px 20px; line-height: 1.6; }

@media (max-width: 900px) {
  .library-stage { position: relative; inset: auto; min-height: 60vh; padding: 14px; }
  .lib-grille { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 11px; }
  .lib-barre select { min-width: 0; flex: 1; }
}

/* Aperçu produit destiné au client */
.apercu-zone { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.apercu-zone img { width: 100%; border-radius: 10px; border: 1px solid var(--border); background: #fff; }
.apercu-zone:empty { display: none; }

/* Pavé de déplacement fin — réservé au tactile.
   Sur ordinateur les flèches du clavier font le travail, ce pavé encombrerait
   inutilement le panneau. Il n'apparaît donc qu'en dessous de 900 px. */
.pave-deplacement { display: none; }

@media (max-width: 900px) {
  .pave-deplacement {
    display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 6px;
    padding: 12px; border-radius: 12px;
    background: var(--bg-input); border: 1px solid var(--border);
  }
  .pave-ligne { display: flex; gap: 6px; align-items: center; }
  .pave-btn {
    min-width: 52px; min-height: 46px; border-radius: 10px; cursor: pointer;
    background: rgba(143, 163, 200, 0.09); border: 1px solid var(--border);
    color: var(--text); font-size: 17px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
  }
  .pave-btn:active { background: var(--accent); border-color: var(--accent); }
  .pave-pas { font-size: 12px; font-weight: 700; min-width: 66px; color: var(--text-muted); }
  .pave-pas.actif { background: var(--accent); border-color: var(--accent); color: #fff; }
}

/* Centrage par axe */
.centrage-row { display: flex; gap: 6px; }
.centrage-btn { font-size: 12px; padding: 9px 6px; }
.centrage-btn:last-child { flex: 0 0 46px; font-size: 15px; }

/* ---------------------------------------------- mini-tutoriel de module */
/* Repliable et memorise : present pour qui decouvre, discret pour qui connait. */
.module-aide {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-left: 2px solid var(--accent, #6c5ce7);
  border-radius: 8px;
  background: rgba(255, 255, 255, .03);
}
.module-aide > summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--accent, #6c5ce7);
  list-style: none;
}
.module-aide > summary::-webkit-details-marker { display: none; }
.module-aide > summary::after { content: ' ▾'; opacity: .6; }
.module-aide[open] > summary::after { content: ' ▴'; }
.module-aide .aide-role {
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-soft, #cbd5e0);
}
.module-aide ol {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted, #a0aec0);
}
.module-aide ol li { margin-bottom: 3px; }
.module-aide .aide-astuce {
  margin: 9px 0 0;
  font-size: 12px;
  font-style: italic;
  line-height: 1.45;
  color: var(--muted, #a0aec0);
}

/* ------------------------------------------------ partage reseaux sociaux */
.case-partage {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 8px 0 2px;
  font-size: 12.5px;
  color: var(--muted, #a0aec0);
  cursor: pointer;
}
.case-partage input { width: auto; margin: 0; cursor: pointer; }
#partageInfo:empty { display: none; }
#partageInfo { color: var(--accent, #6c5ce7); }

/* ------------------------------------- choix d'interface de l'administrateur */
.choix-interface {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--accent, #6c5ce7);
  border-radius: 10px;
  background: rgba(108, 92, 231, .08);
}
.choix-interface[hidden] { display: none; }
.choix-titre {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent, #6c5ce7);
}
.choix-qui { margin: 0 0 10px; font-size: 12.5px; color: var(--muted, #a0aec0); }
.choix-interface .btn { margin-bottom: 7px; }

.bloc-client { margin-bottom: 10px; }
.bloc-client[hidden] { display: none; }
#retourAdmin[hidden] { display: none; }

/* ------------------------------------------------ signature et maintenance */
.login-signature {
  margin: 6px 0 0;
  font-size: 12.5px;
  font-style: italic;
  letter-spacing: .02em;
  color: var(--accent, #6c5ce7);
  opacity: .9;
}
.bandeau-maintenance {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9000;
  padding: 10px 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #2b1a00;
  background: linear-gradient(90deg, #f7971e, #ffd200);
  box-shadow: 0 2px 14px rgba(0, 0, 0, .35);
}
.bandeau-maintenance[hidden] { display: none; }

/* ------------------------------------ fond plein ecran de la page de connexion */
/* L'image occupe toute la page derriere la carte. Elle passe par un pseudo-element
   plutot que par background-image sur .login-screen : cela permet de regler son
   opacite sans toucher a celle de la carte ni du texte, qui doivent rester nets. */
.login-screen.avec-fond::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: var(--fond-login);
  background-size: cover;
  background-position: center;
  opacity: var(--fond-login-opacite, .45);
  pointer-events: none;
}
/* Voile sombre : sans lui, une photo claire rendrait le formulaire illisible. */
.login-screen.avec-fond::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(900px 620px at 50% 45%, rgba(10, 12, 24, .55) 0%, rgba(8, 9, 18, .85) 100%);
  pointer-events: none;
}
.login-screen.avec-fond > .login-card { position: relative; z-index: 1; }

/* ================================================= maquette : etapes et cartes */

.etape { display: flex; gap: 11px; align-items: flex-start; margin-bottom: 12px; }
.etape-num {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
}
.etape-txt { display: flex; flex-direction: column; line-height: 1.35; }
.etape-txt strong { font-size: 14px; color: var(--text); }
.etape-txt em { font-style: normal; font-size: 12px; color: var(--text-muted); }

.support-grille { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.support-carte {
  display: flex; flex-direction: column; gap: 3px; padding: 14px 12px; cursor: pointer;
  border-radius: 14px; border: 1.5px solid var(--border); background: var(--bg-input);
  text-align: left; transition: border-color .15s, transform .12s, box-shadow .15s;
}
.support-carte:hover { border-color: var(--accent); transform: translateY(-1px); }
.support-carte.active {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108, 92, 231, .14);
}
.support-ico { font-size: 21px; line-height: 1; }
.support-nom { font-size: 13px; font-weight: 650; color: var(--text); }
.support-dim { font-size: 11px; color: var(--text-muted); }
.support-dim:empty { display: none; }

/* ================================================= controle qualite */

.qualite-bloc {
  margin-top: 14px; padding: 13px 14px; border-radius: 13px;
  border: 1px solid var(--border); background: var(--bg-input);
}
.qualite-bloc[hidden] { display: none; }
.qualite-tete { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 11px; }
.qualite-tete strong { display: block; font-size: 13.5px; }
.qualite-tete em { font-style: normal; font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.qualite-pastille {
  flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%; margin-top: 1px;
  display: flex; align-items: center; justify-content: center; font-size: 11px; color: #fff;
}
.qualite-bloc.bon    { border-color: rgba(0, 169, 126, .45); }
.qualite-bloc.moyen  { border-color: rgba(247, 151, 30, .5); }
.qualite-bloc.mauvais{ border-color: rgba(255, 118, 117, .55); }
.qualite-bloc.bon     .qualite-pastille { background: var(--success); }
.qualite-bloc.moyen   .qualite-pastille { background: #f7971e; }
.qualite-bloc.mauvais .qualite-pastille { background: #ff7675; }
.qualite-bloc.bon     .qualite-pastille::after { content: '✓'; }
.qualite-bloc.moyen   .qualite-pastille::after { content: '!'; }
.qualite-bloc.mauvais .qualite-pastille::after { content: '×'; }
.qualite-ligne {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 5px 0; font-size: 12.5px; color: var(--text-muted);
}
.qualite-valeur { font-weight: 650; color: var(--text); }
.qualite-valeur.ok { color: var(--success); }
.qualite-valeur.ko { color: #ff7675; }

/* ================================================= profils d'impression */

.profils { display: flex; flex-direction: column; gap: 7px; }
.profil-carte {
  display: flex; flex-direction: column; gap: 1px; padding: 11px 13px; cursor: pointer;
  border-radius: 11px; border: 1px solid var(--border); background: var(--bg-input);
  text-align: left; border-left-width: 3px; transition: border-color .15s;
}
.profil-carte strong { font-size: 13px; color: var(--text); }
.profil-carte em { font-style: normal; font-size: 11px; color: var(--text-muted); }
.profil-carte:hover { border-color: var(--border-fort); }
.profil-carte[data-profil="dtf"]    { border-left-color: #ff7675; }
.profil-carte[data-profil="subli"]  { border-left-color: #6c5ce7; }
.profil-carte[data-profil="vinyle"] { border-left-color: #00a97e; }
.profil-carte.actif {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108, 92, 231, .12);
}

/* ================================================= plan de travail */

/* Quadrillage : repere d'echelle, pose en fond de la zone et jamais sur le canvas
   lui-meme — il ne doit apparaitre dans aucun export. */
.canvas-wrapper.quadrille {
  background-image:
    linear-gradient(var(--plan-grille) 1px, transparent 1px),
    linear-gradient(90deg, var(--plan-grille) 1px, transparent 1px);
  background-size: 22px 22px;
}

.plan-barre {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 7px 11px; border-radius: 13px;
  background: var(--bg-panel); border: 1px solid var(--border);
  box-shadow: var(--ombre); backdrop-filter: var(--flou); z-index: 20;
}
.plan-barre input[type=range] { width: 120px; margin: 0; }
.plan-valeur { font-size: 12px; font-weight: 650; color: var(--text-muted); min-width: 44px; text-align: center; }
.plan-btn {
  width: 28px; height: 28px; border-radius: 8px; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text-muted);
  transition: all .15s;
}
.plan-btn:hover { color: var(--accent); border-color: var(--accent); }

.align-rangee { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.align-rangee .plan-btn { width: 100%; height: 32px; }

@media (max-width: 900px) {
  .support-grille { grid-template-columns: 1fr 1fr; }
  .plan-barre { bottom: 10px; gap: 6px; padding: 6px 9px; }
  .plan-barre input[type=range] { width: 82px; }
}

/* Rappel avant export : un miroir applique par surprise coute une feuille. */
.drapeau-miroir {
  margin-bottom: 9px; padding: 8px 11px; border-radius: 9px;
  font-size: 12px; font-weight: 650; text-align: center;
  color: #8a5a00; background: rgba(247, 151, 30, .15);
  border: 1px solid rgba(247, 151, 30, .45);
}
[data-theme="dark"] .drapeau-miroir { color: #ffd8a8; }
.drapeau-miroir[hidden] { display: none; }
.profil-carte[data-profil="maison"] { border-left-color: var(--text-muted); }

/* En sombre, l'avertissement reprend sa teinte claire : le brun ne s'y lit pas. */
[data-theme="dark"] .demo-notice {
  color: #ffd8a8; background: rgba(255, 176, 80, 0.10); border-color: rgba(255, 176, 80, 0.30);
}
/* Le texte d'aide et le sous-titre restent lisibles : sur une carte claire, un gris
   attenue a 85 % d'opacite tombe sous le seuil de lecture confortable. */
:root .login-sub, :root .login-aide { opacity: 1; color: var(--text-muted); }

/* Bascule de theme sur l'ecran de connexion, en haut a droite de la carte. */
.login-card { position: relative; }
.theme-connexion {
  position: absolute; top: 12px; right: 12px;
  width: 30px; height: 30px; border-radius: 9px; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center; font-size: 13px; line-height: 1;
  background: var(--voile-doux); border: 1px solid var(--border); color: var(--text-muted);
  transition: color .15s, border-color .15s;
}
.theme-connexion:hover { color: var(--accent); border-color: var(--accent); }
