/* ===========================================================================
   Docmaster — systeme de design.

   Direction artistique : "atelier d'edition".
   L'application fabrique des imprimes soignes ; son interface emprunte donc au
   vocabulaire de l'imprimerie de qualite — encre profonde, or chaud, papier
   legerement teinte, serif de labeur pour les titres, grandes respirations.
   Les documents produits sont la matiere premiere de la mise en page : ils
   sont montres en grand, encadres, jamais reduits a une icone.

   Organisation :
     1. Jetons de design (couleurs, echelles, ombres, typographie, mouvement)
     2. Base, typographie et utilitaires
     3. Composants (boutons, champs, cartes, tableaux, alertes, vignettes...)
     4. Structures (site public, coque connectee, editeur, administration)
     5. Mouvement et responsive

   Regle : aucune couleur n'est ecrite en dur hors de la section 1. Changer la
   charte d'un client se fait en modifiant les variables, en un seul endroit.

   Les ecrans publics ajoutent `pages.css` par-dessus cette feuille.
   =========================================================================== */

/* --------------------------------------------------- 1. jetons de design */

:root {
  /* --- encre de marque : du bleu-nuit presque noir au bleu de lecture ---- */
  --brand-950: #050d1a;
  --brand-900: #0a1526;
  --brand-800: #101f38;
  --brand-700: #16304f;
  --brand-600: #1d4372;
  --brand-500: #2b5e9c;
  --brand-200: #b9cde6;
  --brand-100: #e6eefa;
  --brand-50:  #f3f7fd;
  /* Bleu de lien, pose sur une surface : distinct de `--brand-600`, qui sert
     aussi de fond de bouton et ne peut donc pas s'eclaircir en mode sombre. */
  --link: #1d4372;

  /* --- or : l'accent chaud qui reveille l'encre ------------------------- */
  --accent-700: #96620a;
  --accent-600: #c07f0c;
  --accent-500: #e0a020;
  --accent-400: #f0b83f;
  --accent-200: #f9deA0;
  --accent-100: #fdf3de;

  /* --- neutres, legerement chauds : la couleur du papier ---------------- */
  --ink:      #0e1721;
  --ink-2:    #33414f;
  --muted:    #6b7a89;
  --muted-2:  #93a1ae;
  --line:     #e2e7ee;
  --line-2:   #eef1f6;
  --surface:  #ffffff;
  --surface-2:#f7f8fb;
  --surface-3:#eef1f6;
  --paper:    #fbfaf7;   /* fond "papier", legerement creme */

  /* --- etats ------------------------------------------------------------ */
  --ok-600: #067647;   --ok-500: #12a15f;  --ok-100: #dcfae6;
  --warn-600: #b54708; --warn-500: #e08321; --warn-100: #fef0c7;
  --danger-600: #b42318; --danger-500: #e04a3c; --danger-100: #fee4e2;
  --info-600: #175cd3; --info-500: #3b82f6; --info-100: #d1e9ff;

  /* --- espacement : echelle de 4 px ------------------------------------- */
  --s1: 4px;   --s2: 8px;   --s3: 12px;  --s4: 16px;
  --s5: 20px;  --s6: 24px;  --s8: 32px;  --s10: 40px;
  --s12: 48px; --s16: 64px; --s20: 80px; --s24: 96px; --s32: 128px;

  /* --- rayons ------------------------------------------------------------ */
  --r-sm: 7px; --r-md: 11px; --r-lg: 16px; --r-xl: 22px; --r-2xl: 30px;
  --r-full: 999px;

  /* --- ombres teintees : jamais du gris pur, toujours de l'encre -------- */
  --sh-1: 0 1px 2px rgba(10, 21, 38, .06), 0 1px 1px rgba(10, 21, 38, .04);
  --sh-2: 0 2px 4px rgba(10, 21, 38, .05), 0 6px 16px rgba(10, 21, 38, .07);
  --sh-3: 0 4px 8px rgba(10, 21, 38, .05), 0 16px 40px rgba(10, 21, 38, .11);
  --sh-4: 0 8px 16px rgba(10, 21, 38, .07), 0 32px 72px rgba(5, 13, 26, .18);
  --sh-5: 0 16px 32px rgba(10, 21, 38, .10), 0 56px 120px rgba(5, 13, 26, .26);
  /* lueur doree, reservee aux appels a l'action */
  --sh-gold: 0 6px 18px rgba(224, 160, 32, .28), 0 2px 4px rgba(150, 98, 10, .18);
  --ring: 0 0 0 3px rgba(43, 94, 156, .18);
  --ring-gold: 0 0 0 3px rgba(224, 160, 32, .30);

  /* --- typographie ------------------------------------------------------
     Deux familles seulement. Le serif est une pile systeme : il donne
     immediatement le ton "imprime" sans un octet telecharge, ce qui compte
     sur les connexions lentes visees par le produit. */
  --font: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  --font-head: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua',
               Georgia, 'Noto Serif', 'Times New Roman', serif;
  --font-mono: 'Cascadia Mono', Consolas, 'DejaVu Sans Mono', ui-monospace, monospace;

  /* Echelle fluide : le titre d'accueil respire sur grand ecran sans casser
     la lecture sur telephone. */
  --fs-xs:   12px;
  --fs-sm:   13.5px;
  --fs-md:   15.5px;
  --fs-lg:   clamp(16.5px, 1.1vw + 14px, 18.5px);
  --fs-xl:   clamp(19px, 1.4vw + 15px, 23px);
  --fs-2xl:  clamp(21px, 1.6vw + 15px, 27px);
  --fs-3xl:  clamp(26px, 2.4vw + 16px, 38px);
  --fs-4xl:  clamp(31px, 3vw + 18px, 50px);
  --fs-5xl:  clamp(37px, 4vw + 20px, 62px);

  --lh-tight: 1.08;
  --lh-head: 1.18;
  --lh: 1.65;

  /* --- mouvement : court, fonctionnel, jamais decoratif ----------------- */
  --e-out: cubic-bezier(.16, 1, .3, 1);      /* apparitions : depart franc */
  --e-in:  cubic-bezier(.7, 0, .84, 0);      /* disparitions */
  --e-soft: cubic-bezier(.4, 0, .2, 1);
  --t-fast: 140ms var(--e-soft);
  --t: 240ms var(--e-soft);
  --t-slow: 480ms var(--e-out);

  /* --- gabarit ----------------------------------------------------------- */
  --header-h: 72px;
  --sidebar-w: 258px;
  --maxw: 1440px;
  --maxw-wide: 1680px;

  /* Grain : une trame de bruit en SVG, inline, qui casse la platitude des
     grands aplats sombres. Aucun fichier image, aucun appel reseau. */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

/* Mode sombre : les roles sont reassignes, pas mecaniquement inverses.
   Le fond n'est pas noir mais bleu de nuit, pour rester dans la charte. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --ink:      #eef2f7;
    --ink-2:    #c4cedb;
    --muted:    #8b99a9;
    --muted-2:  #6b7a8b;
    --line:     #223046;
    --line-2:   #18243a;
    --surface:  #101b2c;
    --surface-2:#0a1322;
    --surface-3:#182741;
    --paper:    #0a1322;
    --brand-100:#16283f;
    --brand-200:#2c4a6e;
    --link: #8ab4e8;
    --brand-50: #101f38;
    --accent-100:#33270e;
    --accent-200:#5c460f;
    --ok-100:   #0d2c1e;
    --warn-100: #3a2a0c;
    --danger-100:#3a1512;
    --info-100: #10233f;
    --sh-1: 0 1px 2px rgba(0, 0, 0, .5);
    --sh-2: 0 2px 4px rgba(0, 0, 0, .4), 0 6px 16px rgba(0, 0, 0, .45);
    --sh-3: 0 4px 8px rgba(0, 0, 0, .4), 0 16px 40px rgba(0, 0, 0, .5);
    --sh-4: 0 8px 16px rgba(0, 0, 0, .45), 0 32px 72px rgba(0, 0, 0, .6);
    --sh-5: 0 16px 32px rgba(0, 0, 0, .5), 0 56px 120px rgba(0, 0, 0, .7);
    --ring: 0 0 0 3px rgba(96, 152, 224, .28);
  }
}

:root[data-theme='dark'] {
  --ink: #eef2f7; --ink-2: #c4cedb; --muted: #8b99a9; --muted-2: #6b7a8b;
  --line: #223046; --line-2: #18243a;
  --surface: #101b2c; --surface-2: #0a1322; --surface-3: #182741; --paper: #0a1322;
  --brand-100: #16283f; --brand-50: #101f38;
  --link: #8ab4e8;
  --accent-100: #33270e; --accent-200: #5c460f;
  --ok-100: #0d2c1e; --warn-100: #3a2a0c; --danger-100: #3a1512; --info-100: #10233f;
  --sh-1: 0 1px 2px rgba(0, 0, 0, .5);
  --sh-2: 0 2px 4px rgba(0, 0, 0, .4), 0 6px 16px rgba(0, 0, 0, .45);
  --sh-3: 0 4px 8px rgba(0, 0, 0, .4), 0 16px 40px rgba(0, 0, 0, .5);
  --sh-4: 0 8px 16px rgba(0, 0, 0, .45), 0 32px 72px rgba(0, 0, 0, .6);
  --sh-5: 0 16px 32px rgba(0, 0, 0, .5), 0 56px 120px rgba(0, 0, 0, .7);
}

/* Formulaires natifs assortis au theme (champs, molette, barre de defilement). */
:root[data-theme='dark'] { color-scheme: dark; }
:root[data-theme='light'] { color-scheme: light; }

/* --- bouton theme clair/sombre -------------------------------------------
   Un seul bouton, deux icones : on montre la lune en clair (passer en sombre)
   et le soleil en sombre (revenir en clair). L'icone suit le theme en CSS pur,
   qu'il soit choisi (data-theme) ou herite du systeme (prefers-color-scheme),
   donc sans attendre le JavaScript. */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: var(--r-full);
  background: var(--surface); color: var(--ink-2); cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}
.theme-toggle:hover { color: var(--brand-600); border-color: var(--brand-200); }
.theme-toggle:active { transform: scale(.94); }
.theme-toggle .ico-sun { display: none; }
.theme-toggle .ico-moon { display: inline-flex; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle .ico-sun { display: inline-flex; }
  :root:not([data-theme='light']) .theme-toggle .ico-moon { display: none; }
}
:root[data-theme='dark'] .theme-toggle .ico-sun { display: inline-flex; }
:root[data-theme='dark'] .theme-toggle .ico-moon { display: none; }
:root[data-theme='light'] .theme-toggle .ico-sun { display: none; }
:root[data-theme='light'] .theme-toggle .ico-moon { display: inline-flex; }

/* ----------------------------------------------- 2. base et utilitaires */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--s6));
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: var(--lh);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums lining-nums;
}

/* --- titres : serif, serres, contrastes ---------------------------------- */
h1, h2, h3, h4, h5 {
  font-family: var(--font-head);
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -.018em;
  line-height: var(--lh-head);
  text-wrap: balance;
}
h1 { font-size: var(--fs-3xl); line-height: var(--lh-tight); letter-spacing: -.028em; }
h2 { font-size: var(--fs-2xl); letter-spacing: -.022em; }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -.01em; }
h5 { font-size: var(--fs-md); font-weight: 700; }

p { margin: 0; text-wrap: pretty; }

a { color: var(--link); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: color-mix(in srgb, var(--link) 78%, var(--ink)); }

img, svg, iframe { display: block; max-width: 100%; }
iframe { border: 0; }

/* Exception : les apercus de documents doivent conserver leur largeur reelle
   (210 mm pour un CV) — c'est elle qui sert a calculer le facteur d'echelle.
   Les brider a 100 % du cadre donnerait un facteur de 1 et un rendu rogne. */
/* Les cadres d'apercu rendent le document a sa taille reelle puis le mettent
   a l'echelle : le plafond a 100 % ci-dessus les ecraserait a la largeur de
   leur boite, et le facteur calcule vaudrait 1. Toute nouvelle surface
   d'apercu doit figurer ici ET dans la liste `FIT` de app.js. */
.tpl-thumb iframe, .sheet iframe, .peek iframe,
.proj-thumb iframe, .preview-scroll iframe,
.apercu-cadre iframe, .cat-style .vue iframe,
.rail-vue iframe, .acc-carte iframe { max-width: none; }

hr { border: 0; border-top: 1px solid var(--line); margin: var(--s8) 0; }

code, kbd, .mono { font-family: var(--font-mono); font-size: .92em; }

::selection { background: var(--accent-200); color: var(--brand-900); }

/* Anneau de focus unique, visible partout, jamais supprime. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* `hidden` doit toujours l'emporter : plusieurs gabarits posent un
   `style="display:block"` en ligne sur des elements masques par defaut
   (l'apercu d'une photo pas encore choisie, par exemple). */
[hidden] { display: none !important; }

.skip-link {
  position: absolute; left: var(--s4); top: -60px; z-index: 999;
  background: var(--brand-900); color: #fff; padding: var(--s3) var(--s5);
  border-radius: var(--r-md); font-weight: 650; box-shadow: var(--sh-3);
  transition: top var(--t);
}
.skip-link:focus { top: var(--s4); color: #fff; }

/* --- conteneurs ---------------------------------------------------------- */
.container      { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(var(--s4), 3vw, var(--s7)); }
.container-wide { width: 100%; max-width: var(--maxw-wide); margin-inline: auto; padding-inline: clamp(var(--s4), 3vw, var(--s7)); }
.container-sm   { width: 100%; max-width: 760px;  margin-inline: auto; padding-inline: var(--s6); }
.container-xs   { width: 100%; max-width: 470px;  margin-inline: auto; padding-inline: var(--s6); }

/* --- utilitaires --------------------------------------------------------- */
.row         { display: flex; align-items: center; gap: var(--s3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); }
.stack       { display: flex; flex-direction: column; gap: var(--s3); }
.stack-lg    { display: flex; flex-direction: column; gap: var(--s6); }
.grid  { display: grid; gap: var(--s6); }
.g2    { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3    { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4    { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grow  { flex: 1 1 auto; min-width: 0; }
.center{ text-align: center; }
.right { text-align: right; }
.nowrap{ white-space: nowrap; }
.wrap  { flex-wrap: wrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.muted  { color: var(--muted); }
.strong { font-weight: 650; color: var(--ink); }
.small  { font-size: var(--fs-sm); }
.xs     { font-size: var(--fs-xs); }
.lead   { font-size: var(--fs-lg); color: var(--ink-2); line-height: 1.6; max-width: 62ch; }

.mt2 { margin-top: var(--s2); } .mt4 { margin-top: var(--s4); }
.mt5 { margin-top: var(--s5); } .mt6 { margin-top: var(--s6); }
.mt8 { margin-top: var(--s8); } .mt10{ margin-top: var(--s10); }

/* Surtitre : petite capitale doree qui annonce la section. */
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-family: var(--font);
  font-size: var(--fs-xs); font-weight: 750;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent-700);
  padding: var(--s2) var(--s4);
  border-radius: var(--r-full);
  background: var(--accent-100);
  border: 1px solid color-mix(in srgb, var(--accent-500) 26%, transparent);
}
.eyebrow svg { color: var(--accent-600); }

/* Pastilles d'etat : l'information n'est jamais portee par la couleur seule,
   la forme du point et le libelle adjacent la doublent. */
.dot-ok, .dot-warn, .dot-off {
  width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto;
  display: inline-block; margin-right: var(--s1);
}
.dot-ok   { background: var(--ok-500);   box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok-500) 18%, transparent); }
.dot-warn { background: var(--warn-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn-500) 18%, transparent); }
.dot-off  { background: var(--muted-2); }

/* --------------------------------------------------------- 3. composants */

/* --- boutons -------------------------------------------------------------
   Un seul squelette, decline par variantes. Le relief est discret au repos
   et se renforce au survol : le bouton "monte" vers le curseur. */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-bd: var(--line);
  --btn-sh: var(--sh-1);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  font-family: var(--font);
  font-size: var(--fs-sm); font-weight: 650; letter-spacing: -.005em;
  line-height: 1;
  padding: 11px var(--s5);
  min-height: 44px;                 /* cible tactile confortable */
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-md);
  background: var(--btn-bg);
  color: var(--btn-fg);
  box-shadow: var(--btn-sh);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  isolation: isolate;
  transition: transform var(--t-fast), box-shadow var(--t), background var(--t-fast),
              border-color var(--t-fast), color var(--t-fast);
}
.btn:hover  { transform: translateY(-1px); box-shadow: var(--sh-2); color: var(--btn-fg); }
.btn:active { transform: translateY(0); box-shadow: var(--sh-1); transition-duration: 60ms; }
.btn[disabled], .btn.is-busy { opacity: .55; pointer-events: none; }

.btn-accent {
  --btn-bg: linear-gradient(180deg, var(--accent-400), var(--accent-500) 62%, var(--accent-600));
  --btn-fg: #241703;
  --btn-bd: color-mix(in srgb, var(--accent-700) 42%, transparent);
  --btn-sh: var(--sh-gold);
  font-weight: 750;
}
.btn-accent:hover { box-shadow: 0 10px 26px rgba(224, 160, 32, .38), 0 2px 6px rgba(150, 98, 10, .22); }

.btn-ink, .btn-primary {
  --btn-bg: linear-gradient(180deg, var(--brand-700), var(--brand-900));
  --btn-fg: #fff;
  --btn-bd: var(--brand-900);
  --btn-sh: var(--sh-2);
}
.btn-ok     { --btn-bg: var(--ok-600);     --btn-fg: #fff; --btn-bd: var(--ok-600); }
.btn-danger { --btn-bg: var(--danger-600); --btn-fg: #fff; --btn-bd: var(--danger-600); }

.btn-ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-bd: var(--line);
}
.btn-ghost:hover { --btn-bg: var(--surface-3); --btn-bd: var(--muted-2); }

.btn-quiet {
  --btn-bg: transparent; --btn-fg: var(--ink-2); --btn-bd: transparent; --btn-sh: none;
}
.btn-quiet:hover { --btn-bg: var(--surface-3); box-shadow: none; }

.btn-sm  { min-height: 36px; padding: 8px var(--s4); font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn-lg  { min-height: 54px; padding: 15px var(--s8); font-size: var(--fs-md); border-radius: var(--r-lg); }
.btn-block { display: flex; width: 100%; }

/* --- champs de formulaire ------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.label { font-size: var(--fs-sm); font-weight: 650; color: var(--ink-2); transition: color var(--t-fast); }
/* Micro-interaction d'edition : le libelle s'allume quand on remplit son champ. */
.field:focus-within .label { color: var(--brand-600); }
.help  { font-size: var(--fs-xs); color: var(--muted); line-height: 1.5; }
.help code {
  background: var(--surface-3); padding: 1px 5px; border-radius: 4px;
  color: var(--ink-2); font-size: .92em;
}

.input, .select, .textarea {
  width: 100%;
  font-family: var(--font);
  font-size: var(--fs-md);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px var(--s4);
  min-height: 46px;
  box-shadow: inset 0 1px 2px rgba(10, 21, 38, .04);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast), transform var(--t-fast);
}
.textarea { min-height: 112px; resize: vertical; line-height: 1.6; }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted-2); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--ring), inset 0 1px 2px rgba(10, 21, 38, .03);
  background: var(--surface);
  transform: translateY(-1px);
}
@media (prefers-reduced-motion: reduce) {
  .input:focus, .select:focus, .textarea:focus { transform: none; }
}
.select {
  appearance: none;
  padding-right: var(--s10);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7a89' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s4) center;
}
/* Champ fichier : le bouton natif change d'aspect a chaque navigateur.
   On le neutralise et on redessine la zone cliquable. */
.input[type="file"] {
  padding: var(--s2);
  cursor: pointer;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.input[type="file"]::file-selector-button {
  margin-right: var(--s4);
  padding: 8px var(--s4);
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--ink-2);
  font-family: var(--font); font-size: var(--fs-xs); font-weight: 650;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.input[type="file"]::file-selector-button:hover {
  background: var(--brand-100); border-color: var(--brand-500); color: var(--brand-700);
}

.input-color {
  padding: 4px; min-height: 46px; cursor: pointer;
  inline-size: 100%;
}
.input-color::-webkit-color-swatch-wrapper { padding: 0; }
.input-color::-webkit-color-swatch { border: 0; border-radius: var(--r-sm); }

.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.fields-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); }

.check {
  display: flex; align-items: flex-start; gap: var(--s3);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.check:hover { border-color: var(--muted-2); background: var(--surface-2); }
.check input { margin-top: 3px; accent-color: var(--brand-600); width: 17px; height: 17px; flex: 0 0 auto; }
.check:has(input:checked) { border-color: var(--brand-500); background: var(--brand-50); }

/* --- entree en cascade des champs -----------------------------------------
   Les pages d'edition (administration, reglages, editeur) sont surtout des
   formulaires : une carte seule qui apparait ne suffit pas a les rendre
   vivantes. app.js marque chaque champ (.champ-anim) avec son rang (--i) et il
   entre a son tour, doucement. Sans JS ou sans mouvement autorise, les champs
   restent simplement visibles (l'animation ne fait que jouer, elle ne cache
   rien de facon persistante). */
@media (prefers-reduced-motion: no-preference) {
  .champ-anim { animation: champEntre .5s var(--e-out) both; animation-delay: calc(var(--i, 0) * 36ms); }
}
@keyframes champEntre {
  from { opacity: 0; transform: translateY(9px); }
  to   { opacity: 1; transform: none; }
}

/* --- cartes ---------------------------------------------------------------
   Le releve au survol est reserve aux cartes cliquables (`a.card`, `.tpl`) :
   une carte statique qui bouge est une animation gratuite. */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  overflow: clip;
}
.card-p    { padding: var(--s6); }
.card-head { padding: var(--s5) var(--s6); border-bottom: 1px solid var(--line-2); }
.card-body { padding: var(--s6); }
.card-foot { padding: var(--s4) var(--s6); border-top: 1px solid var(--line-2); background: var(--surface-2); }
.card-head h3, .card-head h4 { margin: 0; }

a.card, .card-link {
  display: block; color: inherit;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
a.card:hover, .card-link:hover {
  transform: translateY(-3px); box-shadow: var(--sh-3); border-color: var(--brand-200);
}

/* --- badges et pastilles -------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-xs); font-weight: 650; line-height: 1;
  padding: 5px var(--s3);
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--ink-2);
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-accent  { background: var(--accent-100); color: var(--accent-700); border-color: color-mix(in srgb, var(--accent-500) 28%, transparent); }
.badge-ok      { background: var(--ok-100);     color: var(--ok-600); }
.badge-warn    { background: var(--warn-100);   color: var(--warn-600); }
.badge-danger  { background: var(--danger-100); color: var(--danger-600); }
.badge-info    { background: var(--info-100);   color: var(--info-600); }
.badge-ink     { background: var(--brand-900);  color: #fff; }

/* Etats metier, nommes par la donnee (statut de projet, de paiement...). */
.badge.draft, .badge.nouveau      { background: var(--surface-3);   color: var(--muted); }
.badge.ready, .badge.completed,
.badge.active, .badge.ok,
.badge.traite                     { background: var(--ok-100);      color: var(--ok-600); }
.badge.en_traitement              { background: var(--warn-100);    color: var(--warn-600); }
.badge.archived                   { background: var(--brand-100);   color: var(--brand-700); }

/* --- puces / etiquettes saisies ------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip {
  display: inline-flex; align-items: center; gap: var(--s2);
  padding: 6px var(--s3) 6px var(--s4);
  border-radius: var(--r-full);
  background: var(--brand-50);
  border: 1px solid color-mix(in srgb, var(--brand-500) 18%, transparent);
  color: var(--brand-700);
  font-size: var(--fs-sm); font-weight: 600;
}
.chip button {
  border: 0; background: transparent; cursor: pointer; padding: 0;
  width: 20px; height: 20px; border-radius: 50%;
  color: var(--brand-600); font-size: 15px; line-height: 1;
  display: grid; place-items: center;
  transition: background var(--t-fast), color var(--t-fast);
}
.chip button:hover { background: var(--danger-100); color: var(--danger-600); }

/* --- alertes -------------------------------------------------------------- */
.alert {
  display: flex; gap: var(--s3); align-items: flex-start;
  padding: var(--s4) var(--s5);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  border-left-width: 3px;
  font-size: var(--fs-sm); line-height: 1.55;
  box-shadow: var(--sh-1);
}
.alert-success { background: var(--ok-100);     border-color: var(--ok-600);     color: var(--ok-600); }
.alert-error   { background: var(--danger-100); border-color: var(--danger-600); color: var(--danger-600); }
.alert-warn    { background: var(--warn-100);   border-color: var(--warn-600);   color: var(--warn-600); }
.alert-info    { background: var(--info-100);   border-color: var(--info-600);   color: var(--info-600); }

/* --- tableaux ------------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-1);
}
.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.tbl th {
  text-align: left; font-weight: 700;
  font-size: var(--fs-xs); letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted);
  padding: var(--s4) var(--s5);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1;
  white-space: nowrap;
}
.tbl td { padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr { transition: background var(--t-fast); }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .right { text-align: right; }

/* --- onglets --------------------------------------------------------------
   Le soulignement actif est un pseudo-element : il peut ainsi etre anime. */
.tabs {
  display: flex; gap: var(--s1); flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--s6);
}
.tab {
  position: relative;
  padding: var(--s3) var(--s4);
  font-size: var(--fs-sm); font-weight: 650;
  color: var(--muted);
  background: transparent;              /* defaut sous .tab:hover / .tab.on */
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  transition: color var(--t-fast), background var(--t-fast);
}
.tab::after {
  content: ""; position: absolute; left: var(--s3); right: var(--s3); bottom: -1px;
  height: 2.5px; border-radius: 2px; background: var(--accent-500);
  transform: scaleX(0); transform-origin: center;
  transition: transform var(--t) var(--e-out);
}
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab.on { color: var(--link); }
.tab.on::after { transform: scaleX(1); }
/* Les onglets interactifs sont des <button> : on neutralise le style natif
   pour qu'ils soient identiques aux onglets-liens. On ne force PAS la couleur de
   fond ici, pour laisser jouer .tab:hover et .tab.on. */
.tabs .tab { appearance: none; -webkit-appearance: none; border: 0; cursor: pointer; font-family: inherit; text-align: left; }
.tabs[role="tablist"] .tab:focus-visible { outline: 2px solid var(--accent-500); outline-offset: 3px; }
/* Panneaux d'onglets : un seul visible a la fois. */
.volet[hidden] { display: none; }
.volet { animation: voletEntre var(--t) var(--e-out) both; }
@keyframes voletEntre { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .volet { animation: none; } }

/* Le rail d'onglets reste visible sous la barre du haut quand un panneau est
   long : on change de section sans jamais devoir remonter. (Un en-tete de
   tableau, lui, ne peut pas se coller : .table-wrap a overflow-x pour le
   defilement horizontal, ce qui neutralise sticky — on ne s'y risque pas.) */
.onglets > .tabs {
  position: sticky; top: var(--header-h); z-index: 20;
  background: var(--surface-2);
}

/* --- avatars --------------------------------------------------------------- */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  object-fit: cover; flex: 0 0 auto;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  color: #fff; font-size: var(--fs-xs); font-weight: 750; letter-spacing: .04em;
  box-shadow: var(--sh-1), inset 0 1px 0 rgba(255, 255, 255, .16);
}
.avatar-lg { width: 76px; height: 76px; font-size: var(--fs-xl); }

/* --- etat vide -------------------------------------------------------------
   Un ecran vide soigne est un marqueur de produit fini : illustration,
   phrase utile, action unique et evidente. */
.empty {
  text-align: center;
  padding: var(--s16) var(--s6);
  border: 1.5px dashed var(--line);
  border-radius: var(--r-xl);
  background:
    radial-gradient(120% 90% at 50% -10%, var(--brand-50), transparent 62%),
    var(--surface);
}
.empty-icon {
  width: 72px; height: 72px; margin: 0 auto var(--s5);
  border-radius: var(--r-xl);
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--brand-100), var(--surface-3));
  color: var(--link);
  box-shadow: var(--sh-1), inset 0 1px 0 rgba(255, 255, 255, .7);
}
.empty h3 { margin-bottom: var(--s2); }
.empty p  { color: var(--muted); max-width: 46ch; margin: 0 auto var(--s6); }

/* --- barres de progression et jauges ---------------------------------------- */
.progress {
  height: 8px; border-radius: var(--r-full);
  background: var(--surface-3); overflow: hidden;
}
.progress > i {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-500), var(--accent-500));
  transition: width var(--t-slow);
}
.bars { display: flex; flex-direction: column; gap: var(--s3); }
/* Libelle | jauge | valeur, sur une seule ligne : c'est l'ordre du gabarit. */
.bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(0, 2.4fr) auto;
  gap: var(--s4); align-items: center;
}
.bar-track {
  height: 8px; border-radius: var(--r-full);
  background: var(--surface-3); overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(10, 21, 38, .06);
}
.bar-track > i {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-600), var(--brand-500));
  min-width: 2px;
}
@media (max-width: 640px) {
  .bar-row { grid-template-columns: 1fr auto; gap: var(--s2) var(--s3); }
  .bar-track { grid-column: 1 / -1; order: 3; }
}

/* --- statistique mise en avant ---------------------------------------------- */
.stat {
  padding: var(--s5) var(--s6);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background:
    radial-gradient(110% 130% at 100% 0%, var(--brand-50), transparent 60%),
    var(--surface);
  box-shadow: var(--sh-1);
}
.stat .k { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.stat .v { font-family: var(--font-head); font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.03em; line-height: 1.05; margin-top: var(--s2); }
.stat .d { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--s1); }

/* Chiffres cliquables du tableau de bord : petit ecusson d'icone + survol. */
a.stat-lien { display: block; color: inherit; text-decoration: none;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t); }
a.stat-lien:hover { transform: translateY(-3px); box-shadow: var(--sh-3); border-color: var(--brand-200); }
.stat-lien .k, .stat-lien .v { display: block; }
.stat-ico { display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--r-md);
  background: var(--brand-100); color: var(--brand-600); margin-bottom: var(--s3); }
.stat-ico-or { background: var(--accent-100); color: var(--accent-700); }

/* --- pagination -------------------------------------------------------------- */
.pager { display: flex; gap: var(--s2); justify-content: center; flex-wrap: wrap; margin-top: var(--s8); }
.pager a, .pager span {
  min-width: 40px; height: 40px; padding: 0 var(--s3);
  display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink-2);
  font-size: var(--fs-sm); font-weight: 650;
  transition: all var(--t-fast);
}
.pager a:hover { border-color: var(--brand-500); color: var(--link); transform: translateY(-1px); }
.pager .on { background: var(--brand-800); border-color: var(--brand-800); color: #fff; }

/* --- en-tete de page ---------------------------------------------------------- */
.page-head {
  position: relative;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s6); flex-wrap: wrap;
  margin-bottom: var(--s8);
  padding-bottom: var(--s5);
  border-bottom: 1px solid var(--line);
}
/* Un court trait d'accent sous le titre de page : repere visuel discret qui
   signe chaque page d'edition sans l'alourdir. */
.page-head::after {
  content: ""; position: absolute; left: 0; bottom: -1px;
  width: 48px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-500), var(--brand-500));
}
.page-head h1, .page-head h2 { margin: 0; }
.page-head p { color: var(--muted); margin-top: var(--s2); max-width: 62ch; }

/* --- vignette de modele --------------------------------------------------------
   L'apercu est le vrai document, rendu dans un cadre et mis a l'echelle : ce
   que le client voit ici est exactement ce qu'il telechargera. */
.tpl {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: clip;
  box-shadow: var(--sh-1);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.tpl:hover { transform: translateY(-4px); box-shadow: var(--sh-4); border-color: var(--brand-200); }

.tpl-thumb {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(150deg, var(--surface-3), var(--surface-2));
  border-bottom: 1px solid var(--line-2);
  display: grid; place-items: start center;
}
/* Le liseré interieur imite le bord d'une feuille posee sur un plan. */
.tpl-thumb::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(10, 21, 38, .05), inset 0 -22px 30px -22px rgba(10, 21, 38, .18);
}
.tpl-thumb iframe {
  transform-origin: top left;
  position: absolute; top: 0; left: 0;
  pointer-events: none;
}
.tpl-thumb.card   { background: linear-gradient(150deg, var(--brand-100), var(--surface-2)); }
.tpl-thumb.square { background: linear-gradient(150deg, var(--surface-3), var(--surface)); }

/* La vignette est un lien vers le rendu plein format : l'invite n'apparait
   qu'au survol pour ne pas encombrer une grille de vingt-six modeles, mais
   reste visible au clavier et sur ecran tactile, ou il n'y a pas de survol. */
.tpl-zoom {
  position: absolute; inset: auto 0 0 0; z-index: 1;
  display: flex; align-items: center; justify-content: center; gap: var(--s2);
  padding: var(--s3) var(--s4);
  background: linear-gradient(0deg, rgba(10, 21, 38, .88), rgba(10, 21, 38, 0));
  color: #fff; font-size: var(--fs-xs); font-weight: 650; letter-spacing: .02em;
  opacity: 0; transform: translateY(6px);
  transition: opacity var(--t), transform var(--t);
}
.tpl:hover .tpl-zoom,
.tpl-thumb:focus-visible .tpl-zoom { opacity: 1; transform: none; }
@media (hover: none) { .tpl-zoom { opacity: 1; transform: none; } }

/* Bouton d'action pose sur l'apercu. Sous le texte, il rendait chaque carte
   quarante pixels plus haute — une rangee entiere sur un catalogue de
   vingt-six. En surcouche il ne coute aucune hauteur.

   Il ne disparait jamais vraiment : le survol le revele a la souris, le focus
   au clavier, et la ou le survol n'existe pas il reste affiche en permanence.
   Une action qu'on ne peut pas atteindre au doigt n'existe pas. */
.tpl-frame { position: relative; display: flex; flex-direction: column; }
.tpl-act {
  position: absolute; top: var(--s3); right: var(--s3); z-index: 2;
  opacity: 0; transform: translateY(-5px);
  transition: opacity var(--t), transform var(--t);
}
.tpl-act .btn { box-shadow: var(--sh-3); }
.tpl:hover .tpl-act,
.tpl:focus-within .tpl-act { opacity: 1; transform: none; }
@media (hover: none) { .tpl-act { opacity: 1; transform: none; } }

/* --- grille de vignettes -------------------------------------------------
   Vit ici et non dans pages.css : l'espace connecte ne charge que cette
   feuille, et son ecran « choisissez un modele » fait exactement le meme
   travail que le catalogue public. Laissee de l'autre cote, la grille y
   perdait tout style — vingt-six cartes empilees sur toute la largeur. */
/* Grille du catalogue : les feuilles A4 sont hautes, on laisse de l'air. */
.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(206px, 1fr)); gap: var(--s5); }

/* --- variante dense --------------------------------------------------------
   Le catalogue faisait 4 143 px pour 26 modeles : sept rangees de cartes de
   560 px, dont 393 px d'apercu au ratio A4. On resserre la grille et on
   recadre la vignette sur le haut du document — c'est la que se lisent la
   charte et la mise en page. Le document entier reste a un clic, dans
   l'apercu plein format.

   Reserve aux pages qui font choisir parmi des dizaines de modeles. La
   vitrine de l'accueil n'en montre que quatre : elle garde ses grandes
   feuilles, ou l'on vient regarder et non trancher. */
.catalog.compact { gap: var(--s4); }

/* Vignette recadree. La hauteur doit etre imposee, pas bornee : l'iframe est
   en position absolue, le cadre n'a donc aucune hauteur propre — `max-height`
   seul le laisse s'effondrer a zero. */
.catalog.compact .tpl-thumb { height: 232px; aspect-ratio: auto !important; }
.catalog.compact .tpl-thumb.card   { height: 150px; }
.catalog.compact .tpl-thumb.square { height: 206px; }

/* Le pied de carte tenait sur 165 px : titre, categorie, description sur
   quatre lignes, pastilles et bouton. Les pastilles sont parties — l'apercu
   montre deja les vraies couleurs — le bouton est passe en surcouche, et la
   description tient sur deux lignes. Elle reste entiere dans l'apercu plein
   format, et c'est elle que la recherche interroge. */
.catalog.compact .tpl-body { padding: var(--s4); gap: var(--s2); }
.catalog.compact .tpl-body p {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; font-size: var(--fs-xs); line-height: 1.45; flex: 0 1 auto;
}
.catalog.compact .tpl-body h4 { font-size: var(--fs-md); }

/* Reveal progressif : au-dela de la premiere fournee, les cartes sont
   masquees jusqu'au clic. Sans JavaScript la classe n'est jamais posee et
   tout reste affiche, comme avant.

   Le selecteur vise l'enfant direct, quel qu'il soit : le catalogue public
   emballe chaque carte dans un `.reveal` anime, l'ecran de choix de l'espace
   connecte pose l'article nu. Viser `.reveal` ne masquait rien sur le second,
   et les vingt-six modeles s'affichaient malgre le bouton. */
.catalog.tronque > *:nth-child(n + 13) { display: none; }

/* Apercu plein format. Le `dialog` natif apporte le piegeage du focus, la
   fermeture par Echap et l'inertie de l'arriere-plan sans code supplementaire. */
.apercu-dlg {
  width: min(96vw, 900px); max-height: 92vh;
  padding: 0; border: 0; border-radius: var(--r-xl);
  background: var(--surface); box-shadow: var(--sh-4);
  overflow: hidden;
}
.apercu-dlg::backdrop { background: rgba(10, 21, 38, .72); backdrop-filter: blur(2px); }
.apercu-dlg header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.apercu-dlg header h3 { margin: 0; font-size: var(--fs-md); }
.apercu-dlg iframe {
  display: block; width: 100%; height: min(78vh, 1000px);
  border: 0; background: var(--surface-3);
}

.tpl-body { padding: var(--s5); display: flex; flex-direction: column; gap: var(--s3); flex: 1; }
.tpl-body h4 { margin: 0; }
.tpl-body p  { font-size: var(--fs-sm); color: var(--muted); line-height: 1.5; flex: 1; }

.tpl-swatch { display: flex; gap: 5px; }
.tpl-swatch i {
  width: 15px; height: 15px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(10, 21, 38, .12);
}

/* Selecteur de modele dans l'editeur. */
.tpl-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s4); }
.tpl-pick {
  border: 2px solid var(--line); border-radius: var(--r-md);
  padding: var(--s2); cursor: pointer; background: var(--surface);
  transition: border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t);
}
.tpl-pick:hover { border-color: var(--brand-200); transform: translateY(-2px); box-shadow: var(--sh-2); }
.tpl-pick.selected, .tpl-pick.on {
  border-color: var(--accent-500);
  box-shadow: var(--ring-gold);
}
/* Pastille de charte + nom : la vignette dit la couleur avant le mot. */
.tpl-pick .sw { display: block; width: 100%; height: 34px; border-radius: var(--r-sm); }
.tpl-pick .nm {
  display: block; margin-top: var(--s2);
  font-size: var(--fs-xs); font-weight: 650; color: var(--ink-2);
  text-align: center; line-height: 1.3;
}
.tpl-pick.on .nm { color: var(--accent-700); }

/* --- carte de service ------------------------------------------------------- */
.svc {
  display: flex; flex-direction: column; gap: var(--s3);
  padding: var(--s6);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: inherit;
  position: relative;
  overflow: clip;
  box-shadow: var(--sh-1);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
/* Un voile dore monte du bas au survol : la carte "s'allume". */
.svc::before {
  content: ""; position: absolute; inset: auto 0 0 0; height: 0;
  background: linear-gradient(0deg, var(--accent-100), transparent);
  transition: height var(--t) var(--e-out);
  z-index: 0;
}
.svc:hover { transform: translateY(-4px); box-shadow: var(--sh-4); border-color: color-mix(in srgb, var(--accent-500) 40%, transparent); }
.svc:hover::before { height: 100%; }
.svc > * { position: relative; z-index: 1; }
.svc h3 { font-size: var(--fs-lg); }
.svc p  { font-size: var(--fs-sm); color: var(--muted); flex: 1; }
.svc-icon {
  width: 52px; height: 52px; border-radius: var(--r-md);
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--brand-700), var(--brand-900));
  color: var(--accent-400);
  box-shadow: var(--sh-2), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.svc .go {
  font-size: var(--fs-sm); font-weight: 700; color: var(--link);
  display: inline-flex; align-items: center; gap: var(--s2);
}
.svc:hover .go { color: var(--accent-700); }

/* --- assistant IA ----------------------------------------------------------- */
.ai-btn {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-size: var(--fs-xs); font-weight: 700;
  padding: 8px var(--s4); min-height: 36px;
  border-radius: var(--r-full);
  border: 1px solid color-mix(in srgb, var(--accent-500) 42%, transparent);
  background: linear-gradient(180deg, var(--accent-100), color-mix(in srgb, var(--accent-200) 55%, var(--surface)));
  color: var(--accent-700);
  cursor: pointer;
  transition: all var(--t-fast);
}
.ai-btn::before { content: "\2726"; font-size: 1.05em; line-height: 1; }
.ai-btn:hover { border-color: var(--accent-500); box-shadow: var(--sh-gold); transform: translateY(-1px); }
.ai-btn[disabled] { opacity: .5; pointer-events: none; }

.ai-option {
  padding: var(--s4);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}
.ai-option:hover { border-color: var(--accent-500); background: var(--accent-100); transform: translateX(2px); }

/* --- divers ------------------------------------------------------------------ */
.sw { width: 22px; height: 22px; border-radius: var(--r-sm); box-shadow: inset 0 0 0 1px rgba(10, 21, 38, .12); }
.ico { display: inline-flex; flex: 0 0 auto; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 40px; }
.spark i { flex: 1; background: var(--brand-500); border-radius: 2px 2px 0 0; min-height: 2px; opacity: .85; }
.spark i:last-child { background: var(--accent-500); opacity: 1; }
.currency { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ---------------------------------------------------- 4. structures */

/* --- en-tete du site public ---------------------------------------------------
   Barre translucide qui se densifie au defilement (classe `is-stuck` posee
   par app.js) : elle disparait visuellement sur le heros sombre, puis prend
   corps des que le contenu passe dessous. */
.site-header {
  position: sticky; top: 0; z-index: 60;
  height: var(--header-h);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: background var(--t), border-color var(--t), box-shadow var(--t);
}
.site-header.is-stuck {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom-color: var(--line);
  box-shadow: var(--sh-1);
}
.site-header .inner { height: var(--header-h); display: flex; align-items: center; gap: var(--s6); }

.logo {
  display: inline-flex; align-items: center; gap: var(--s3);
  font-family: var(--font-head);
  font-size: var(--fs-lg); font-weight: 700; letter-spacing: -.02em;
  color: var(--ink); flex: 0 0 auto;
}
.logo em { font-style: normal; color: var(--accent-600); }
/* Le nom et la devise, l'un sous l'autre. La devise disparait des que
   l'en-tete se resserre : elle explique, elle ne navigue pas. */
.logo-txt { display: flex; flex-direction: column; line-height: 1.06; }
.logo-txt small {
  font-family: var(--font); font-size: 11px; font-weight: 500;
  letter-spacing: .005em; color: var(--muted);
}
.site-header.on-stage .logo-txt small { color: #a7bcd6; }
.nav-rech {
  display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto;
  border-radius: 50%; color: inherit;
}
.nav-rech:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
@media (max-width: 1180px) { .logo-txt small { display: none; } }
.logo:hover { color: var(--ink); }
.logo-mark {
  width: 38px; height: 38px; border-radius: 11px;
  /* La tuile reste claire : l'embleme est sombre, il doit tenir aussi bien
     sur l'en-tete blanc que sur la barre laterale `--brand-950`. */
  background: #fff url("/assets/img/logo-mark.png") center / 78% no-repeat;
  box-shadow: var(--sh-2);
  position: relative;
}
/* Un filet dore au bord du monogramme : detail d'imprimerie. */
.logo-mark::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-500) 34%, transparent);
}

.nav { display: flex; align-items: center; gap: var(--s1); margin-left: auto; }
/* `:not(.btn)` est indispensable : sans lui, cette regle l'emporte sur la
   couleur des boutons du menu, qui perdent leur variante. */
.nav > a:not(.btn) {
  position: relative;
  padding: var(--s2) var(--s3);
  font-size: var(--fs-sm); font-weight: 600;
  color: var(--ink-2); border-radius: var(--r-sm);
  transition: color var(--t-fast), background var(--t-fast);
}
.nav > a:not(.btn)::after {
  content: ""; position: absolute; left: var(--s3); right: var(--s3); bottom: 3px;
  height: 2px; border-radius: 2px; background: var(--accent-500);
  transform: scaleX(0); transform-origin: left;
  transition: transform var(--t) var(--e-out);
}
.nav > a:not(.btn):hover { color: var(--ink); }
.nav > a:not(.btn):hover::after,
.nav > a.on::after { transform: scaleX(1); }
.nav > a.on { color: var(--link); }
.nav .btn { margin-left: var(--s2); }

.burger {
  display: none;
  width: 44px; height: 44px;
  align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.burger:hover { background: var(--surface-3); }

/* --- sections publiques --------------------------------------------------- */
/* 128 px en haut et en bas faisaient 256 px par section : sur les sept
   sections de l'accueil, pres de deux ecrans de vide avant meme le contenu.
   Une page se parcourt, elle ne se contemple pas. */
.section { padding: clamp(var(--s10), 4vw, var(--s16)) 0; }
.section-alt { background: var(--surface-2); border-block: 1px solid var(--line-2); }
.section-head { max-width: 66ch; margin: 0 auto var(--s8); text-align: center; }
.section-head .eyebrow { margin-bottom: var(--s5); }
.section-head h2 { margin-bottom: var(--s4); }
.section-head p { color: var(--muted); font-size: var(--fs-lg); }
.section-head.left { margin-inline: 0; text-align: left; }

/* --- etapes --------------------------------------------------------------- */
.steps {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--s6);
  counter-reset: step;
}
.step {
  position: relative;
  padding: var(--s6) var(--s5) var(--s5);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
}
.step::before {
  counter-increment: step; content: counter(step, decimal-leading-zero);
  position: absolute; top: calc(var(--s6) * -1 + 4px); left: var(--s5);
  font-family: var(--font-head); font-size: var(--fs-xl); font-weight: 700;
  color: var(--accent-600);
  background: var(--surface); padding-inline: var(--s2);
}
.step h4 { margin-bottom: var(--s2); }
.step p  { font-size: var(--fs-sm); color: var(--muted); }

/* --- pied de page --------------------------------------------------------- */
.site-footer {
  background: var(--brand-950);
  color: #9fb0c4;
  padding: var(--s12) 0 var(--s6);
  position: relative;
  overflow: hidden;
}
.site-footer::before {
  content: ""; position: absolute; inset: 0;
  background-image: var(--grain); opacity: .05; pointer-events: none;
}
.site-footer > * { position: relative; }
.footer-grid {
  display: grid; grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: var(--s8); margin-bottom: var(--s7);
}
.site-footer h5 {
  color: #fff; font-family: var(--font);
  font-size: var(--fs-xs); letter-spacing: .14em; text-transform: uppercase;
  margin-bottom: var(--s4); font-weight: 750;
}
.site-footer a { color: #9fb0c4; font-size: var(--fs-sm); display: block; padding: 3px 0; }
.site-footer a:hover { color: var(--accent-400); }
.site-footer .logo { color: #fff; }
.site-footer .logo em { color: var(--accent-400); }
/* Les listes du pied de page sont des colonnes de liens, pas des puces. */
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { font-size: var(--fs-sm); color: #9fb0c4; padding: 3px 0; }

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, .1);
  padding-top: var(--s5);
  display: flex; justify-content: space-between; gap: var(--s4); flex-wrap: wrap;
  font-size: var(--fs-xs); color: #7d8fa5;
}

/* --- coque des espaces connectes ------------------------------------------ */
.shell { display: flex; min-height: 100vh; background: var(--surface-2); }

.side {
  width: var(--sidebar-w); flex: 0 0 auto;
  background: var(--brand-950);
  color: #b6c4d4;
  padding: var(--s5) var(--s4) var(--s6);
  display: flex; flex-direction: column; gap: var(--s5);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  scrollbar-width: thin;
  border-right: 1px solid rgba(255, 255, 255, .07);
}
.side::-webkit-scrollbar { width: 8px; }
.side::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 4px; }
.side .logo { color: #fff; padding: var(--s2) var(--s2) var(--s4); }
.side .logo em { color: var(--accent-400); }
/* L'espace d'administration se distingue par un liseré, pas par une autre charte. */
.side-admin { box-shadow: inset 3px 0 0 var(--accent-500); }

.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-group .cap {
  font-size: 10.5px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
  color: #64788f; padding: var(--s4) var(--s3) var(--s2);
}
.side-group a, .side-foot a, .side-foot button {
  display: flex; align-items: center; gap: var(--s3);
  padding: 10px var(--s3);
  border-radius: var(--r-md);
  color: #b6c4d4; font-size: var(--fs-sm); font-weight: 550;
  position: relative;
  transition: background var(--t-fast), color var(--t-fast);
}
.side-group a svg, .side-foot a svg, .side-foot button svg { flex: 0 0 auto; opacity: .8; }
.side-group a:hover, .side-foot a:hover, .side-foot button:hover {
  background: rgba(255, 255, 255, .07); color: #fff;
}
.side-group a.on {
  background: linear-gradient(90deg, color-mix(in srgb, var(--brand-600) 55%, transparent), rgba(255, 255, 255, .04));
  color: #fff; font-weight: 650;
}
/* Marqueur dore de l'element actif. */
.side-group a.on::before {
  content: ""; position: absolute; left: -var(--s4); left: calc(var(--s4) * -1 + 4px);
  top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%; border-radius: 0 3px 3px 0;
  background: var(--accent-500);
}
.side-group a.on svg { opacity: 1; color: var(--accent-400); }

.side-foot { margin-top: auto; padding-top: var(--s4); border-top: 1px solid rgba(255, 255, 255, .09); }
.side-foot .btn { color: #b6c4d4; }
.side-foot .btn:hover { background: rgba(255, 255, 255, .07); color: #fff; }

.backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(5, 13, 26, .58);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  animation: fade .2s var(--e-out);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  display: flex; align-items: center; gap: var(--s4);
  padding: 0 var(--s8);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar > strong { font-family: var(--font-head); font-size: var(--fs-lg); letter-spacing: -.015em; }

.content { padding: var(--s8); flex: 1; max-width: 1500px; width: 100%; }

/* --- accueil de l'espace client ----------------------------------------------
   On ne se connecte pas pour lire un tableau de bord, on s'y connecte pour
   fabriquer un document. La page s'ouvre donc sur ce qu'on peut lancer ; les
   compteurs, qui repondaient a une question que personne n'avait posee,
   tiennent sur une ligne. */
.bureau { display: grid; grid-template-columns: minmax(0, 1fr) 292px; gap: var(--s8); align-items: start; }
.bureau-main { min-width: 0; }
.bureau-cote { display: flex; flex-direction: column; gap: var(--s5); position: sticky; top: var(--s8); }

.hello { margin-bottom: var(--s6); }
.hello h1 { font-size: var(--fs-2xl); margin: 0 0 var(--s2); letter-spacing: -.02em; }
.hello p { max-width: 62ch; font-size: var(--fs-md); color: var(--ink-2); }

/* Les compteurs en une ligne de liens : ils informent qui les cherche et
   n'encombrent personne d'autre. */
.compteurs { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin-top: var(--s4); }
.compteurs a { font-size: var(--fs-sm); color: var(--muted); }
.compteurs a:hover { color: var(--link); }
.compteurs b { color: var(--ink); font-weight: 750; font-variant-numeric: tabular-nums; }

/* --- portes d'entree ---------------------------------------------------------
   Cinq tuiles, la premiere en tete : creer un document est la raison d'etre du
   compte, le reste se consulte. La teinte distingue au coup d'oeil ce qui
   fabrique de ce qui range. */
/* Cinq tuiles, pastille coloree en tete, comme la maquette. La teinte n'est
   pas decorative : elle distingue au coup d'oeil ce qui fabrique de ce qui
   range, et c'est ce qui permet de viser sans lire. */
.portes { display: grid; grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)); gap: var(--s4); margin-bottom: var(--s8); }
.porte {
  display: flex; flex-direction: column; gap: var(--s2);
  padding: var(--s5);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink);
  box-shadow: var(--sh-1);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.porte:hover { transform: translateY(-3px); box-shadow: var(--sh-3); border-color: var(--brand-200); color: var(--ink); }
.porte .ico {
  width: 48px; height: 48px; border-radius: var(--r-md);
  display: grid; place-items: center; margin-bottom: var(--s3);
}
.porte b { font-size: var(--fs-sm); font-weight: 700; line-height: 1.3; }
.porte small { font-size: var(--fs-xs); color: var(--muted); line-height: 1.4; }
.porte.ta .ico { background: var(--accent-100); color: var(--accent-700); }
.porte.tb .ico { background: var(--brand-100); color: var(--brand-700); }
.porte.tc .ico { background: var(--ok-100);     color: var(--ok-600); }
.porte.td .ico { background: var(--info-100);   color: var(--info-600); }
.porte.te .ico { background: var(--warn-100);   color: var(--warn-600); }

.bloc { margin-bottom: var(--s8); }
.titre-bloc { font-size: var(--fs-lg); margin: 0 0 var(--s4); letter-spacing: -.01em; }

/* Pastilles de type et de format sur une vignette, comme sur les catalogues
   auxquels le client nous compare : « CV » puis « PDF ». */
.tpl-tags { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s1); }
.tpl-tags .tag {
  padding: 2px var(--s2); border-radius: var(--r-sm);
  background: var(--surface-3); color: var(--ink-2);
  font-size: 10px; font-weight: 750; letter-spacing: .03em;
}
.tpl-tags .tag.fmt { background: var(--danger-100); color: var(--danger-600); }

/* --- bandeau lateral : signature et carte d'offre ------------------------- */
.logo-side .logo-txt { display: flex; flex-direction: column; line-height: 1.1; }
.logo-side .logo-txt small {
  font-size: 10px; font-weight: 500; letter-spacing: .02em;
  opacity: .6; margin-top: 3px;
}
.side-offre {
  margin: var(--s5) var(--s4) 0;
  padding: var(--s4);
  border-radius: var(--r-lg);
  background: linear-gradient(160deg, var(--brand-800), var(--brand-950));
  border: 1px solid color-mix(in srgb, var(--accent-500) 26%, transparent);
  color: #e8eef6;
}
.side-offre .couronne {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  display: grid; place-items: center; margin-bottom: var(--s3);
  background: var(--accent-500); color: var(--brand-950);
}
.side-offre b { display: block; font-size: var(--fs-sm); }
.side-offre p { font-size: 11px; line-height: 1.5; opacity: .74; margin: var(--s2) 0 var(--s3); }
.side-offre a {
  display: block; text-align: center; padding: 7px;
  border-radius: var(--r-sm); background: var(--accent-500); color: var(--brand-950);
  font-size: var(--fs-xs); font-weight: 750;
}
.side-offre a:hover { background: var(--accent-400); color: var(--brand-950); }

.partout .svc-icon { width: 34px; height: 34px; margin-bottom: var(--s3); }

/* Bande « document assorti » : une offre, pas une decoration. Elle ne parait
   que si le compte a deja un document — sans quoi elle promettrait une suite
   a rien. */
.assorti {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s5) var(--s6); flex-wrap: wrap;
  padding: var(--s5) var(--s6);
  border: 1px solid color-mix(in srgb, var(--accent-500) 30%, transparent);
  border-radius: var(--r-lg);
  background: radial-gradient(120% 140% at 0% 0%, var(--accent-100), transparent 62%), var(--surface);
}
.assorti-txt { min-width: 0; flex: 1 1 320px; }
.assorti-txt h2 { font-size: var(--fs-md); margin: 0 0 var(--s2); }
.assorti-txt p { font-size: var(--fs-sm); color: var(--muted); line-height: 1.5; max-width: 60ch; }
.assorti-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.bloc h2 { font-size: var(--fs-md); margin: 0; }

/* --- colonne laterale -------------------------------------------------------- */
.bureau-cote .card { padding: var(--s5); }
.bureau-cote h3 { font-size: var(--fs-sm); margin: 0; }
.bureau-cote p { font-size: var(--fs-xs); color: var(--muted); line-height: 1.55; margin: var(--s2) 0 var(--s4); }
.bureau-cote p b { color: var(--ink); }
.promo { background: radial-gradient(130% 130% at 100% 0%, var(--accent-100), transparent 60%), var(--surface); }
.promo .svc-icon { width: 34px; height: 34px; margin-bottom: var(--s3); }

/* Reprises recentes : une liste, pas des cartes — on la parcourt du regard. */
.recents { list-style: none; display: flex; flex-direction: column; gap: var(--s1); }
.recents a {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s2); border-radius: var(--r-md); color: var(--ink);
  transition: background var(--t-fast);
}
.recents a:hover { background: var(--surface-2); color: var(--ink); }
.recents .ico {
  width: 30px; height: 30px; flex: 0 0 auto; border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--link);
}
.recents .txt { min-width: 0; }
.recents .txt b { display: block; font-size: var(--fs-xs); font-weight: 650; }
.recents .txt small { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }

/* Miniature de projet reduite a une icone quand il n'y a pas encore de rendu. */
.proj-thumb.ico-only {
  display: grid; place-items: center;
  aspect-ratio: 1;
  background: linear-gradient(150deg, var(--brand-100), var(--surface-3));
  color: var(--link);
}

/* Mention "facultatif" accolee a un libelle de champ. */
.opt { font-weight: 500; color: var(--muted-2); font-size: .92em; }

/* --- fichiers importes --------------------------------------------------- */
.depot .input[type="file"] { padding: var(--s3); cursor: pointer; }

/* Jauge d'espace : elle passe a l'orange avant d'etre pleine. Prevenir a
   100 % ne sert plus a rien, le televersement a deja echoue. */
.jauge { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.jauge span { display: block; height: 100%; border-radius: 999px; background: var(--brand-700); }
.jauge span.pleine { background: var(--warn-600); }

.fichiers { display: flex; flex-direction: column; gap: var(--s2); }
.fichier {
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface);
}
.fichier:hover { border-color: var(--brand-200); }
/* La pastille de format porte la couleur de la famille : on repere un PDF
   dans une liste de trente sans lire son nom. */
.fichier .fmt {
  width: 46px; height: 46px; flex: 0 0 auto; border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--muted);
  font-size: 10px; font-weight: 800; letter-spacing: .04em;
}
.fichier .fmt.fpdf  { background: var(--danger-100); color: var(--danger-600); }
.fichier .fmt.fdoc,
.fichier .fmt.fdocx,
.fichier .fmt.fodt  { background: var(--info-100);   color: var(--info-600); }
.fichier .fmt.fxls,
.fichier .fmt.fxlsx,
.fichier .fmt.fods  { background: var(--ok-100);     color: var(--ok-600); }
.fichier .fmt.fppt,
.fichier .fmt.fpptx { background: var(--warn-100);   color: var(--warn-600); }
.fichier-txt { min-width: 0; flex: 1; }
.fichier-txt b { display: block; font-size: var(--fs-sm); font-weight: 650; }
.fichier-txt small { display: block; font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
.fichier-act { display: flex; align-items: center; gap: var(--s2); flex: 0 0 auto; }

/* --- coeur de mise de cote ------------------------------------------------
   Vide, il suit le survol comme les autres actions de vignette. Plein, il
   reste visible en permanence : un favori qu'on ne voit pas ne se retire
   pas. */
.tpl-coeur { position: absolute; top: var(--s3); left: var(--s3); z-index: 2; }
.tpl-coeur button {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: var(--muted);
  opacity: 0; transform: translateY(-4px);
  transition: opacity var(--t), transform var(--t), color var(--t-fast);
}
.tpl-coeur svg { width: 16px; height: 16px; fill: currentColor; display: block; }
.tpl:hover .tpl-coeur button,
.tpl:focus-within .tpl-coeur button { opacity: 1; transform: none; }
.tpl-coeur button:hover { color: var(--danger-600); }
.tpl-coeur.plein button {
  opacity: 1; transform: none;
  color: var(--danger-600); border-color: color-mix(in srgb, var(--danger-500) 40%, transparent);
}
@media (hover: none) { .tpl-coeur button { opacity: 1; transform: none; } }

/* --- barre du haut : recherche et cloche ------------------------------------
   On cherche depuis la ou l'on est, pas depuis une page dediee. Le champ vit
   donc dans l'en-tete de l'espace connecte, entre le titre et le compte. */
.quete { position: relative; flex: 0 1 420px; margin: 0 var(--s5); min-width: 0; }
.quete-ico {
  position: absolute; left: var(--s4); top: 50%; transform: translateY(-50%);
  display: flex; color: var(--muted); pointer-events: none;
}
.quete input {
  width: 100%;
  padding: 8px var(--s4) 8px calc(var(--s4) + 21px);
  border: 1px solid var(--line); border-radius: var(--r-full);
  background: var(--surface-2); color: var(--ink);
  font-family: inherit; font-size: var(--fs-sm);
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.quete input::placeholder { color: var(--muted-2); }
.quete input:focus-visible {
  outline: none; border-color: var(--brand-500);
  background: var(--surface); box-shadow: var(--ring);
}

.cloche {
  position: relative; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: var(--r-md);
  color: var(--ink-2); transition: background var(--t-fast), color var(--t-fast);
}
.cloche:hover { background: var(--surface-2); color: var(--ink); }
/* Le compteur ne parait que s'il y a quelque chose a lire : une pastille a
   zero est un ornement anxiogene. */
.pastille-n {
  position: absolute; top: 2px; right: 2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; display: grid; place-items: center;
  background: var(--danger-500); color: #fff;
  font-size: 10px; font-weight: 800; line-height: 1;
}

/* --- ecran « choisissez un modele » ------------------------------------------
   Un atelier a trois colonnes : on filtre a gauche, on parcourt au centre, on
   regarde en grand a droite. La page etait une grille precedee d'un titre. */
.fil { display: flex; gap: var(--s2); margin-bottom: var(--s6); overflow-x: auto; scrollbar-width: none; }
.fil::-webkit-scrollbar { display: none; }
.fil-etape {
  display: flex; align-items: center; gap: var(--s3); flex: 1 0 auto;
  padding: var(--s3) var(--s4);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--muted);
  font-size: var(--fs-xs); font-weight: 600;
}
.fil-etape .n {
  width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--muted);
  font-size: 11px; font-weight: 800;
}
/* Seule l'etape en cours est marquee : numeroter les suivantes en couleur
   laisserait croire qu'elles sont faites. */
.fil-etape.on { border-color: var(--brand-900); background: var(--brand-900); color: #fff; }
.fil-etape.on .n { background: var(--accent-500); color: var(--brand-950); }

.atelier { display: grid; grid-template-columns: 214px minmax(0, 1fr) 300px; gap: var(--s6); align-items: start; }
.atelier-cote { display: flex; flex-direction: column; gap: var(--s4); position: sticky; top: var(--s6); }
.atelier-cote h3 { font-size: var(--fs-sm); margin: 0 0 var(--s3); }
.atelier-grille { min-width: 0; }
.atelier-apercu { position: sticky; top: var(--s6); }

/* Rangs de categories : une liste verticale se parcourt plus vite qu'une
   rangee d'onglets quand il y en a plus de cinq. */
.rangs { display: flex; flex-direction: column; gap: 2px; }
.rang {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2);
  padding: var(--s2) var(--s3); border-radius: var(--r-sm);
  color: var(--ink-2); font-size: var(--fs-xs); font-weight: 600;
  transition: background var(--t-fast), color var(--t-fast);
}
.rang:hover { background: var(--surface-2); color: var(--ink); }
.rang.on { background: var(--brand-900); color: #fff; }
.rang .n { font-size: 11px; opacity: .7; font-variant-numeric: tabular-nums; }

.teintes { display: flex; flex-direction: column; gap: 2px; }
.teinte {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s2) var(--s3); border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--ink-2);
  font-family: inherit; font-size: var(--fs-xs); font-weight: 600; text-align: left;
  cursor: pointer; transition: background var(--t-fast);
}
.teinte:hover { background: var(--surface-2); }
.teinte.on { background: var(--surface-3); color: var(--ink); }
.teinte .pastille {
  width: 15px; height: 15px; border-radius: 50%; flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(10, 21, 38, .14);
}
.teinte .pastille.arc {
  background: conic-gradient(#2f6ab0, #3f8a68, #c07a33, #b8324a, #8f6bb5, #2f6ab0);
}

/* La vignette choisie porte l'anneau d'accent : sans marque, on ne sait plus
   lequel des vingt modeles le panneau de droite est en train de montrer. */
.atelier [data-modele].choisi .tpl {
  border-color: var(--accent-500);
  box-shadow: 0 0 0 2px var(--accent-500), var(--sh-3);
}

/* Le cadre d'apercu garde le rapport d'une page A4 : l'iframe rend le
   document a sa taille reelle, `app.js` le met a l'echelle. */
.apercu-cadre {
  position: relative; overflow: hidden;
  aspect-ratio: 210 / 297;
  background: var(--surface-3);
  border-bottom: 1px solid var(--line-2);
}
.apercu-cadre iframe {
  position: absolute; top: 0; left: 0;
  width: 210mm; height: 297mm; border: 0;
  transform-origin: top left; pointer-events: none;
}
.atelier-apercu .card-foot { background: var(--surface); }

/* --- rangee de pastilles -----------------------------------------------------
   Primitive d'interface, pas element de page : le catalogue public s'en sert
   pour ses filtres, l'espace connecte pour choisir un type de document. Elle
   vivait dans pages.css, que le shell connecte ne charge pas — les pastilles
   y tombaient en liste de liens nus. */
.filter-row { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.filter-row .lbl {
  font-size: var(--fs-xs); font-weight: 750; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-right: var(--s2);
}
.pill {
  display: inline-flex; align-items: center; gap: var(--s2);
  padding: 8px var(--s4); min-height: 38px;
  border-radius: var(--r-full);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--fs-sm); font-weight: 600;
  transition: all var(--t-fast);
}
.pill:hover { border-color: var(--brand-500); color: var(--link); transform: translateY(-1px); }
.pill.on {
  background: linear-gradient(180deg, var(--brand-700), var(--brand-900));
  border-color: var(--brand-900); color: #fff;
  box-shadow: var(--sh-2);
}
.pill.on:hover { color: #fff; }
.pill .n { font-size: var(--fs-xs); opacity: .7; font-variant-numeric: tabular-nums; }

/* Sur telephone la rangee defile lateralement au lieu de s'empiler : sept
   pastilles faisaient quatre lignes et repoussaient le contenu. */
@media (max-width: 820px) {
  .filter-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .filter-row::-webkit-scrollbar { display: none; }
  .filter-row > * { flex: 0 0 auto; }
}

/* --- carte de projet -------------------------------------------------------- */
.proj {
  display: grid; grid-template-columns: 92px 1fr auto;
  gap: var(--s5); align-items: center;
  padding: var(--s4);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-1);
  transition: box-shadow var(--t), border-color var(--t), transform var(--t);
}
.proj:hover { box-shadow: var(--sh-3); border-color: var(--brand-200); transform: translateY(-2px); }
.proj-thumb {
  aspect-ratio: 210 / 297; border-radius: var(--r-sm);
  background: linear-gradient(150deg, var(--surface-3), var(--surface-2));
  overflow: hidden; position: relative;
  box-shadow: inset 0 0 0 1px rgba(10, 21, 38, .07);
}
.proj-thumb iframe { position: absolute; top: 0; left: 0; transform-origin: top left; pointer-events: none; }
.proj-main { min-width: 0; }
.proj-main h4 { margin-bottom: var(--s1); }
.proj-actions { display: flex; gap: var(--s2); flex-wrap: wrap; justify-content: flex-end; }

/* --- blocs repetables du formulaire ---------------------------------------- */
.block {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); padding: var(--s5);
  box-shadow: var(--sh-1);
}
.block > legend, legend {
  font-family: var(--font-head);
  font-size: var(--fs-lg); font-weight: 650; letter-spacing: -.015em;
  color: var(--ink); padding: 0 var(--s2); margin-left: calc(var(--s2) * -1);
}
.repeat-item {
  position: relative;
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: var(--s5); margin-bottom: var(--s4);
  background: var(--surface-2);
  transition: border-color var(--t-fast), box-shadow var(--t);
}
.repeat-item:hover { border-color: var(--brand-200); box-shadow: var(--sh-1); }
.repeat-item .rm {
  position: absolute; top: var(--s3); right: var(--s3);
  width: 30px; height: 30px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); cursor: pointer;
  display: grid; place-items: center;
  transition: all var(--t-fast);
}
.repeat-item .rm:hover { border-color: var(--danger-600); color: var(--danger-600); background: var(--danger-100); }

.exp-role    { font-weight: 700; }
.exp-company { color: var(--muted); }
.exp-missions{ font-size: var(--fs-sm); }

/* --- details / accordeon ----------------------------------------------------- */
details.card > summary,
.studio-form details > summary {
  cursor: pointer; list-style: none;
  padding: var(--s5) var(--s6);
  font-family: var(--font-head); font-size: var(--fs-lg); font-weight: 650;
  display: flex; align-items: center; gap: var(--s3);
  transition: background var(--t-fast);
}
details > summary::-webkit-details-marker { display: none; }
details.card > summary::after,
.studio-form details > summary::after {
  content: ""; margin-left: auto;
  width: 9px; height: 9px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform var(--t);
}
details[open].card > summary::after,
.studio-form details[open] > summary::after { transform: rotate(-135deg) translate(-3px, -3px); }
details.card > summary:hover { background: var(--surface-2); }
/* Un resume porteur d une classe de taille garde cette taille : sans cela le
   serif large ecrase les petits accordeons de formulaire. */
details.card > summary.small { font-family: var(--font); font-size: var(--fs-sm); }
details.card > summary.xs    { font-family: var(--font); font-size: var(--fs-xs); }

/* ------------------------------------------- 5. mouvement et responsive */

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

/* Revelation au defilement : la classe `is-in` est posee par app.js via un
   IntersectionObserver. Sans JavaScript, le contenu reste visible.

   Chaque bloc entre a sa maniere — du bas, de la gauche, de la droite, en
   zoom ou en fondu net. app.js repartit les directions et echelonne les
   retards pour que les elements arrivent en cascade, pas d'un bloc. */
/* Les etats caches ne s'appliquent qu'avec JavaScript (html.js) : sans lui,
   tout reste visible et navigable. app.js pose `js` des son chargement. */
html.js .reveal { opacity: 0; transform: translateY(26px); will-change: transform, opacity; }
html.js .reveal.from-l { transform: translateX(-44px); }
html.js .reveal.from-r { transform: translateX(44px); }
html.js .reveal.from-up { transform: translateY(48px); }
html.js .reveal.from-scale { transform: scale(.9); }
html.js .reveal.from-blur { transform: translateY(14px); filter: blur(10px); }
html.js .reveal.is-in {
  opacity: 1; transform: none; filter: none;
  transition: opacity .7s var(--e-out), transform .8s var(--e-out), filter .7s var(--e-out);
}
.reveal.d1 { transition-delay: .06s; }
.reveal.d2 { transition-delay: .13s; }
.reveal.d3 { transition-delay: .2s; }
.reveal.d4 { transition-delay: .27s; }
.reveal.d5 { transition-delay: .34s; }
.reveal.d6 { transition-delay: .41s; }

/* Entree du bandeau au chargement : le texte monte, la pile de documents
   arrive de la droite. app.js pose `is-ready` sur le bandeau au premier rendu. */
html.js .acc-hero .acc-hero-txt > * { opacity: 0; transform: translateY(22px); }
html.js .acc-hero .acc-hero-vis { opacity: 0; transform: translateX(48px) scale(.96); }
html.js .acc-hero.is-ready .acc-hero-txt > * {
  opacity: 1; transform: none;
  transition: opacity .7s var(--e-out), transform .8s var(--e-out);
}
html.js .acc-hero.is-ready .acc-hero-txt > *:nth-child(1) { transition-delay: .05s; }
html.js .acc-hero.is-ready .acc-hero-txt > *:nth-child(2) { transition-delay: .14s; }
html.js .acc-hero.is-ready .acc-hero-txt > *:nth-child(3) { transition-delay: .23s; }
html.js .acc-hero.is-ready .acc-hero-txt > *:nth-child(4) { transition-delay: .32s; }
html.js .acc-hero.is-ready .acc-hero-vis {
  opacity: 1; transform: none;
  transition: opacity .9s var(--e-out), transform 1s var(--e-out); transition-delay: .2s;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  html.js .reveal { opacity: 1; transform: none; filter: none; }
  html.js .acc-hero .acc-hero-txt > *,
  html.js .acc-hero .acc-hero-vis { opacity: 1; transform: none; }
}

/* --- grands ecrans ----------------------------------------------------------- */
@media (max-width: 1180px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--s8); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  /* L'atelier perd sa colonne d'apercu avant de perdre sa grille : c'est le
     confort, pas la fonction. */
  .atelier { grid-template-columns: 190px minmax(0, 1fr); }
  .atelier-apercu { display: none; }
  /* La colonne laterale ne tient plus a cote : elle passe dessous, ou elle
     reste consultable sans rien pousser hors de l'ecran. */
  .bureau { grid-template-columns: 1fr; gap: var(--s6); }
  .bureau-cote { position: static; }
  .side {
    position: fixed; inset: 0 auto 0 0; z-index: 90;
    transform: translateX(-100%);
    transition: transform var(--t) var(--e-out);
    box-shadow: var(--sh-5);
  }
  .side.open { transform: none; }
  .content { padding: var(--s5); }
  .topbar { padding: 0 var(--s5); }
  .burger { display: inline-flex; }
}

@media (max-width: 820px) {
  :root { --header-h: 64px; }
  /* Le titre de page se lit deja dans le contenu : sur un ecran etroit il
     cede la place au champ de recherche, qui n'a nulle part ailleurs ou
     aller. */
  .topbar .titre-page { display: none; }
  .quete { flex: 1 1 auto; margin: 0 var(--s3); }
  .atelier { grid-template-columns: 1fr; }
  .atelier-cote { position: static; flex-direction: row; flex-wrap: wrap; }
  .atelier-cote > .card { flex: 1 1 220px; }
  .fil-etape .t { display: none; }
  .fil-etape { flex: 1 1 auto; justify-content: center; }
  .fil-etape.on .t { display: inline; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .fields-3 { grid-template-columns: 1fr 1fr; }

  /* La navigation publique bascule en panneau plein ecran, pas en liste
     comprimee : c'est un layout different, pas le meme en plus petit. */
  .nav {
    position: fixed; inset: var(--header-h) 0 auto 0;
    flex-direction: column; align-items: stretch;
    gap: var(--s1);
    padding: var(--s5) var(--s6) var(--s8);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--sh-4);
    transform: translateY(-12px); opacity: 0; pointer-events: none;
    transition: opacity var(--t), transform var(--t) var(--e-out);
    max-height: calc(100vh - var(--header-h)); overflow-y: auto;
  }
  .nav.open { transform: none; opacity: 1; pointer-events: auto; }
  .nav > a:not(.btn) { padding: var(--s4) var(--s3); font-size: var(--fs-md); border-bottom: 1px solid var(--line-2); }
  .nav > a:not(.btn)::after { display: none; }
  .nav .btn { margin: var(--s2) 0 0; justify-content: center; }
  .burger { display: inline-flex; margin-left: auto; }

  .footer-grid { grid-template-columns: 1fr; gap: var(--s6); }
  .page-head { flex-direction: column; align-items: stretch; }
  .proj { grid-template-columns: 68px 1fr; }
  .proj-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 560px) {
  /* Une seule colonne donnait une page de 6 736 px. Le catalogue dense passe
     a deux : la vignette reste assez large pour reconnaitre une mise en page,
     et c'est tout ce qu'on lui demande a ce stade. La vitrine de l'accueil,
     elle, garde sa colonne unique et ses grandes feuilles. */
  .catalog { grid-template-columns: 1fr; }
  .catalog.compact { grid-template-columns: repeat(2, 1fr); gap: var(--s3); }
  .container, .container-wide, .container-sm, .container-xs { padding-inline: var(--s4); }
  .content { padding: var(--s4); }
  .card-p, .card-body, .card-head { padding: var(--s5); }
  .fields-2, .fields-3 { grid-template-columns: 1fr; }
  .section { padding: var(--s12) 0; }
  .btn-lg { width: 100%; }
}

/* --- impression : on ne sort que le document, jamais l'interface ------------ */
@media print {
  .site-header, .site-footer, .side, .topbar, .studio-top, .studio-tabs, .preview-bar, .btn, .nav, .skip-link { display: none !important; }
  body { background: #fff; }
  .content, .studio-body { padding: 0; }
}

/* Onglet Assistant : les actions restees dans l'editeur, listees sans etre
   dupliquees — chaque ligne renvoie a son champ. */
.ia-action {
  width: 100%; text-align: left;
  padding: var(--s4);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-2); color: inherit;
  font: inherit; cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.ia-action:hover { border-color: var(--brand-200); background: var(--surface); }
.ia-action > span:last-child { color: var(--brand-600); white-space: nowrap; }

/* Le bouton vise depuis l'onglet Assistant clignote une fois : sans cela on
   arrive sur un ecran de champs sans savoir lequel etait cherche. */
@keyframes ia-vise { 0%, 100% { box-shadow: none; } 50% { box-shadow: 0 0 0 4px var(--accent-200); } }
.ai-btn.ia-vise { animation: ia-vise 1.6s ease; }
@media (prefers-reduced-motion: reduce) { .ai-btn.ia-vise { animation: none; outline: 2px solid var(--accent-500); } }

/* --- reglages d'apparence : pastilles de couleur --------------------------
   Un `input radio` masque sous une pastille : le choix reste accessible au
   clavier et lisible par un lecteur d'ecran, sans dessiner un bouton radio
   a cote de chaque teinte. */
.teinte { position: relative; display: inline-flex; cursor: pointer; }
.teinte input {
  position: absolute; inset: 0; opacity: 0; margin: 0;
  width: 100%; height: 100%; cursor: pointer;
}
.teinte i {
  width: 30px; height: 30px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(10, 21, 38, .18);
  transition: box-shadow var(--t-fast), transform var(--t-fast);
}
.teinte input:checked + i {
  box-shadow: inset 0 0 0 1px rgba(10, 21, 38, .18), 0 0 0 3px var(--surface), 0 0 0 5px var(--brand-500);
  transform: scale(1.06);
}
.teinte input:focus-visible + i { box-shadow: inset 0 0 0 1px rgba(10, 21, 38, .18), 0 0 0 3px var(--accent-400); }

/* --- editeur ----------------------------------------------------------------
   Un atelier plein ecran, sur le modele des outils de mise en page : la page
   ne defile plus, chaque zone defile seule.

     .studio-top       barre d'application, pleine largeur
     .studio-tabs      rail d'onglets, a gauche
     .studio-form      le panneau de l'onglet actif
     .studio-preview   le plan de travail, qui prend tout le reste

   La premiere version empilait des cartes flottantes de 60 px de haut et des
   titres en serif de 18 px au-dessus d'un apercu rogne a droite : l'ecran
   ressemblait a une page d'administration, pas a un atelier. */
body.studio-page { overflow: hidden; background: var(--surface-3); }

.studio {
  --st-top: 56px;
  --st-panneau: clamp(360px, 29vw, 440px);
  display: grid;
  grid-template-columns: auto var(--st-panneau) minmax(0, 1fr);
  grid-template-rows: var(--st-top) minmax(0, 1fr);
  grid-template-areas: "top top top" "rail form apercu";
  height: 100vh; height: 100dvh;
  overflow: hidden;
  font-size: 14px;
  background: var(--surface-3);
}

/* -- barre d'application --------------------------------------------------- */
.studio-top {
  grid-area: top;
  position: relative; z-index: 60;
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
  padding: 0 14px 0 10px;
  color: #fff;
  background: linear-gradient(90deg, var(--brand-950), var(--brand-800));
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04), 0 2px 10px rgba(5, 13, 26, .18);
}
.st-retour {
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 9px;
  color: rgba(255, 255, 255, .78);
  transition: background var(--t-fast), color var(--t-fast);
}
.st-retour:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.st-marque { flex: 0 0 auto; display: flex; }
.st-marque .logo-mark { width: 30px; height: 30px; border-radius: 8px; box-shadow: none; }

.st-nom { display: flex; align-items: center; gap: 6px; min-width: 0; margin-left: 4px; }
.st-nom-champ {
  width: clamp(150px, 24vw, 340px); min-width: 0;
  height: 34px; padding: 0 10px;
  font: inherit; font-size: 14.5px; font-weight: 650; color: #fff;
  background: transparent;
  border: 1px solid transparent; border-radius: 8px;
  text-overflow: ellipsis;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.st-nom-champ:hover { border-color: rgba(255, 255, 255, .16); }
.st-nom-champ:focus { outline: 0; background: rgba(255, 255, 255, .08); border-color: var(--accent-500); }
.st-nom-ok {
  display: none;
  height: 28px; padding: 0 10px;
  font: inherit; font-size: 12px; font-weight: 700; color: var(--brand-950);
  background: var(--accent-400); border: 0; border-radius: 7px; cursor: pointer;
}
.st-nom.modifie .st-nom-ok, .st-nom:focus-within .st-nom-ok { display: inline-block; }

.st-type {
  flex: 0 0 auto;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; color: rgba(255, 255, 255, .72);
  background: rgba(255, 255, 255, .08);
  white-space: nowrap;
}
.studio-top .save-state { color: rgba(255, 255, 255, .7); font-weight: 600; }
.studio-top .save-state i { background: rgba(255, 255, 255, .4); }

.st-droite { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.st-droite .badge { font-size: 11px; }

/* Outils d'edition dans la barre (annuler, refaire, aide). */
.st-outils { display: inline-flex; gap: 4px; }
.st-ic {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  cursor: pointer; transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.st-ic:hover:not(:disabled) { color: var(--brand-600); border-color: var(--brand-200); background: var(--brand-50); }
.st-ic:disabled { opacity: .4; cursor: default; }

/* Aide : raccourcis clavier (surcouche modale). */
.st-raccourcis { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: var(--s4); }
.st-raccourcis[hidden] { display: none; }
.st-aide-fond { position: absolute; inset: 0; background: rgba(5, 13, 26, .55); }
.st-aide-carte {
  position: relative; width: 100%; max-width: 420px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--sh-5); padding: var(--s6);
}
.st-aide-tete { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s4); }
.st-aide-tete h3 { margin: 0; display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-lg); }
.st-aide-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s1); }
.st-aide-liste li {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: var(--s2) 0; border-bottom: 1px solid var(--line-2); font-size: var(--fs-sm);
}
.st-aide-liste li:last-child { border-bottom: 0; }
.st-aide-liste span { color: var(--ink-2); }
.st-aide-liste kbd {
  font-family: var(--font); font-size: 11px; font-weight: 700; line-height: 1;
  padding: 4px 7px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px;
  background: var(--surface-2); color: var(--ink);
}
.st-aide-pied { margin: var(--s4) 0 0; font-size: var(--fs-xs); color: var(--muted); }

/* Palettes suggerees (editeur de logo). */
.palettes { display: flex; flex-wrap: wrap; gap: var(--s2); }
.palette-chip {
  display: inline-flex; width: 48px; height: 30px; border-radius: var(--r-md);
  overflow: hidden; border: 2px solid var(--line); cursor: pointer; padding: 0;
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.palette-chip span { flex: 1; display: block; }
.palette-chip:hover { transform: translateY(-2px); border-color: var(--brand-200); }
.palette-chip.on { border-color: var(--brand-500); box-shadow: var(--ring); }
.st-complet { font-size: 12px; font-weight: 600; color: rgba(255, 255, 255, .66); white-space: nowrap; }

.st-menu { position: relative; }
.st-menu > summary { list-style: none; gap: 6px; min-height: 36px; padding: 0 12px; cursor: pointer; }
.st-menu > summary::-webkit-details-marker { display: none; }
.st-menu > summary:hover { transform: none; }
.st-menu-liste {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 80;
  width: 270px; padding: 6px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--sh-4);
}
.st-menu-liste a {
  display: grid; gap: 1px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--ink);
}
.st-menu-liste a:hover { background: var(--surface-2); color: var(--ink); }
.st-menu-liste strong { font-size: 13px; }
.st-menu-liste span { font-size: 12px; color: var(--muted); }

.st-progression { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(255, 255, 255, .06); }
.st-progression i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent-600), var(--accent-400));
  transition: width var(--t-slow);
}

/* -- rail d'onglets ---------------------------------------------------------- */
.studio-tabs {
  grid-area: rail;
  display: flex; flex-direction: column; gap: 4px;
  width: 78px; padding: 10px 8px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.studio-tab {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 2px 8px;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: 11px; font-weight: 650; line-height: 1.1;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.studio-tab:hover { color: var(--ink); background: var(--surface-2); }
.studio-tab.on { color: var(--brand-700); background: var(--brand-50); }
.studio-tab.on svg { color: var(--accent-600); }
.studio-tab:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }

/* -- panneau ----------------------------------------------------------------- */
.studio-form {
  grid-area: form;
  min-width: 0; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.st-flash .container { width: auto; max-width: none; margin: 12px 16px 0 !important; padding: 0; }
.st-flash .alert { padding: 10px 12px; font-size: 13px; }

.studio-body { display: block; min-width: 0; padding: 16px 16px 20px; }
/* Sans JavaScript, les panneaux se suivent : un filet les separe. */
.studio-body + .studio-body { border-top: 1px solid var(--line-2); }
.studio-tabs:not([hidden]) ~ .studio-form .studio-body { border-top: 0; }

.st-entete {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin: 0 0 14px;
}
.st-entete h2 {
  margin: 0;
  font-family: var(--font); font-size: 16px; font-weight: 750; letter-spacing: -.01em; line-height: 1.3;
  color: var(--ink);
}
.st-entete p { margin: 2px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.st-entete form { flex: 0 0 auto; }

.st-titre {
  margin: 22px 0 4px;
  font-family: var(--font); font-size: 13px; font-weight: 750; letter-spacing: 0;
  color: var(--ink);
}
.st-aide { margin: 0 0 10px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.st-groupe { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.st-teintes { display: flex; flex-wrap: wrap; gap: 8px; }

.studio .btn-xs {
  min-height: 30px; padding: 5px 10px; gap: 6px;
  font-size: 12px; border-radius: 8px;
}
.studio .btn-sm { min-height: 34px; padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }

.st-enregistrer { display: flex; align-items: center; gap: 12px; margin-top: 16px; }

/* Listes de lignes cliquables : formats, fichiers, versions. */
.st-liste { display: flex; flex-direction: column; gap: 6px; }
.st-ligne {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.st-ligne:hover { border-color: var(--brand-200); background: var(--surface-2); color: var(--ink); }
.st-ligne > svg { margin-left: auto; color: var(--muted); flex: 0 0 auto; }
.st-ligne-txt { display: grid; min-width: 0; }
.st-ligne-txt strong { font-size: 13px; }
.st-ligne-txt span { font-size: 12px; color: var(--muted); }
.st-pastille {
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: 40px; height: 32px; border-radius: 7px;
  font-size: 11px; font-weight: 800; letter-spacing: .04em;
  color: var(--brand-700); background: var(--brand-50);
}
.studio .ia-action { padding: 10px 12px; border-radius: 10px; }

.st-credits { flex: 0 0 auto; display: grid; justify-items: center; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); }
.st-credits strong { font-size: 18px; line-height: 1.1; }
.st-credits span { font-size: 11px; color: var(--muted); }

/* -- choix du modele --------------------------------------------------------- */
.st-filtres { display: flex; gap: 6px; overflow-x: auto; margin: -4px 0 12px; padding-bottom: 2px; scrollbar-width: none; }
.st-filtres button {
  flex: 0 0 auto;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-2);
  cursor: pointer;
}
.st-filtres button:hover { border-color: var(--muted-2); }
.st-filtres button.on { background: var(--brand-900); border-color: var(--brand-900); color: #fff; }

.st-modeles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.st-modele {
  display: flex; flex-direction: column; gap: 6px;
  padding: 0; border: 0; background: none;
  font: inherit; text-align: left; color: var(--ink); cursor: pointer;
}
.st-vignette.tpl-thumb {
  display: block;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface-3);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.st-vignette.tpl-thumb::after { box-shadow: none; }
.st-modele:hover .st-vignette { border-color: var(--brand-200); box-shadow: var(--sh-2); transform: translateY(-2px); }
.st-modele.on .st-vignette { border-color: var(--accent-500); box-shadow: 0 0 0 2px var(--accent-500); }
.st-modele:focus-visible { outline: 0; }
.st-modele:focus-visible .st-vignette { box-shadow: 0 0 0 3px var(--brand-500); }
.st-modele-nom { font-size: 12.5px; font-weight: 650; padding: 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-actuel {
  position: absolute; left: 6px; top: 6px; z-index: 2;
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px 2px 5px; border-radius: 999px;
  font-size: 10.5px; font-weight: 750; color: var(--brand-950);
  background: var(--accent-400);
}

/* -- formulaire : densite ---------------------------------------------------- */
.studio .input, .studio .select, .studio .textarea {
  min-height: 34px; padding: 6px 10px;
  font-size: 13.5px; border-radius: 8px;
}
.studio .select { padding-right: 30px; }
.studio .textarea { min-height: 70px; line-height: 1.5; }
.studio .input[type="file"] { padding: 4px; font-size: 12.5px; }
.studio .input[type="file"]::file-selector-button { min-height: 24px; padding: 3px 10px; margin-right: 10px; border-radius: 6px; }
/* Vignette de photo encore vide : sa colonne ne doit pas decaler le champ. */
.studio [data-upload] > div:first-child:has(> img[data-preview][hidden]) { display: none; }
.studio [data-upload].row { gap: 12px !important; margin-bottom: 0 !important; }
.studio .field { gap: 5px; }
.studio .label { font-size: 12px; font-weight: 650; color: var(--ink-2); }
.studio .help { font-size: 11.5px; margin: 0; }
.studio .fields-2, .studio .fields-3 { gap: 10px; }
.studio .chips { gap: 6px; }
.studio .ai-btn { min-height: 28px; padding: 4px 10px; font-size: 11.5px; }
.studio .block .small, .studio .block p.muted { font-size: 12.5px; line-height: 1.5; }

/* Les blocs du formulaire. La legende est sortie du bord du cadre (`float`) :
   rendue a cheval sur la bordure, elle flottait au-dessus de sa carte. Le
   `fieldset` devient une colonne a espacement regulier — sans cela les champs
   se touchaient d'un bloc a l'autre. */
.studio .block {
  display: flex; flex-direction: column; gap: 12px;
  margin: 0 0 10px; padding: 12px 14px 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); box-shadow: none;
}
.studio .block > legend {
  float: left; width: 100%;
  margin: 0; padding: 0;
  font-family: var(--font); font-size: 13.5px; font-weight: 750; letter-spacing: 0;
  color: var(--ink);
}
.studio .block.pliable { gap: 0; padding: 0 14px; }
.studio .block.pliable > legend {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 0;
  cursor: pointer; user-select: none;
}
.studio .block.pliable > legend::after {
  content: ""; flex: 0 0 auto;
  width: 7px; height: 7px; margin-right: 3px;
  border-right: 2px solid var(--muted-2); border-bottom: 2px solid var(--muted-2);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform var(--t-fast);
}
.studio .block.pliable:hover > legend::after { border-color: var(--ink-2); }
.studio .block.pliable.ouvert { gap: 12px; padding-bottom: 14px; border-color: var(--brand-200); box-shadow: var(--sh-1); }
.studio .block.pliable.ouvert > legend { padding-bottom: 10px; border-bottom: 1px solid var(--line-2); }
.studio .block.pliable.ouvert > legend::after { transform: rotate(-135deg) translate(-2px, -2px); }
.studio .block.pliable > legend:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; border-radius: 6px; }
/* Un bloc replie ne montre que son titre. On masque le contenu plutot que de
   le retirer : les champs restent dans le formulaire, donc envoyes a
   l'enregistrement meme quand leur section est fermee. L'ancienne regle
   rouvrait avec `display: revert`, qui ramenait chaque grille de champs a un
   simple bloc : Prenom et Nom s'empilaient au lieu de partager la ligne. */
.studio .block.pliable:not(.ouvert) > *:not(legend) { display: none; }

.studio [data-list] { display: flex; flex-direction: column; gap: 10px; }
.studio .repeat-item {
  display: flex; flex-direction: column; gap: 10px;
  margin: 0; padding: 12px;
  border-radius: 10px;
}
.studio .repeat-item > .rm + * { padding-right: 30px; }
.studio .repeat-item .rm { top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 7px; }

.studio details.card { margin: 0 0 10px !important; padding: 0 !important; border-radius: 12px; box-shadow: none; }
.studio details.card > summary {
  padding: 12px 14px;
  font-family: var(--font); font-size: 13.5px; font-weight: 750;
}
.studio details.card > summary + div { margin: 0 !important; padding: 0 10px 10px; }
.studio details.card .block { border-color: var(--line-2); }

/* -- plan de travail ---------------------------------------------------------- */
.studio-preview {
  grid-area: apercu;
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
}
.preview-bar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 12px;
  min-height: 48px; padding: 6px 12px 6px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted);
}
.pv-format { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pv-format strong { color: var(--ink); font-weight: 750; margin-right: 4px; }
.pv-fp { margin-left: 4px; }
.pv-pages {
  flex: 0 0 auto;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; color: var(--ink-2);
  background: var(--surface-3);
}
.pv-outils { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.pv-groupe {
  display: inline-flex; align-items: center; gap: 1px;
  padding: 2px; border-radius: 9px;
  background: var(--surface-3);
}
.pv-btn {
  display: inline-grid; place-items: center;
  min-width: 30px; height: 30px; padding: 0 6px;
  border: 0; border-radius: 7px;
  background: transparent; color: var(--ink-2);
  font: inherit; font-size: 12px; font-weight: 650;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.pv-btn:hover { background: var(--surface); color: var(--ink); }
.pv-btn.on { background: var(--surface); color: var(--brand-700); box-shadow: var(--sh-1); }
.pv-btn:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 1px; }
.pv-pct { min-width: 54px; font-family: var(--font-mono); font-size: 11.5px; }
.pv-outils > .pv-btn { background: var(--surface-3); height: 34px; min-width: 34px; border-radius: 9px; }
.pv-outils > .pv-btn:hover { background: var(--line); }
@keyframes pv-tourne { to { transform: rotate(360deg); } }
.pv-btn.tourne svg { animation: pv-tourne .9s linear infinite; }

.preview-scroll {
  flex: 1 1 auto; min-height: 0;
  display: flex;
  overflow: auto;
  padding: 32px;
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--muted) 26%, transparent) 1px, transparent 0) 0 0 / 20px 20px,
    var(--surface-3);
}
/* La scene porte la taille a l'ecran ; ses marges automatiques la centrent
   tant qu'elle tient, et la collent au bord des qu'elle deborde — un
   `place-items: center` la coupait a gauche au premier zoom. */
.preview-stage { position: relative; flex: 0 0 auto; margin: auto; }
.preview-stage iframe {
  position: absolute; left: 0; top: 0; z-index: 1;
  display: block; border: 0;
  background: transparent;
  transform-origin: 0 0;
  pointer-events: none;
}
.preview-stage iframe.pv-tampon { visibility: hidden; }
.pv-ombre {
  position: absolute; left: 0; z-index: 0;
  background: #fff;
  box-shadow: 0 1px 2px rgba(10, 21, 38, .08), 0 14px 36px rgba(10, 21, 38, .16);
  pointer-events: none;
}
.pv-coupure {
  position: absolute; left: 0; right: 0; z-index: 2;
  border-top: 1px dashed rgba(180, 35, 24, .55);
  pointer-events: none;
}
.pv-coupure span {
  position: absolute; right: 6px; top: 4px;
  padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 700; color: #fff;
  background: rgba(180, 35, 24, .82);
}

/* -- etat d'enregistrement ------------------------------------------------------ */
.save-state {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 650; color: var(--muted);
  white-space: nowrap;
}
.save-state i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted-2); transition: background var(--t-fast), box-shadow var(--t-fast);
}
/* `studio.js` pose saving, saved et error : les classes ok, warn et busy
   d'origine n'etaient jamais posees, et la pastille restait grise. */
.studio-top .save-state.saved i, .save-state.saved i { background: var(--ok-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok-500) 22%, transparent); }
.studio-top .save-state.error i, .save-state.error i { background: var(--danger-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger-500) 25%, transparent); }
.studio-top .save-state.saving i, .save-state.saving i { background: var(--accent-500); animation: pulse 1.1s ease-in-out infinite; }

/* -- ecrans etroits ------------------------------------------------------------
   Sous 1080 px le plan de travail devient un onglet : le garder a cote
   reduirait les deux a des colonnes illisibles. Le rail passe en barre du bas,
   a portee de pouce. Sans JavaScript, formulaire et apercu se partagent la
   hauteur, chacun defilant seul. */
@media (max-width: 1080px) {
  .studio { display: flex; flex-direction: column; }
  .studio-top { flex: 0 0 var(--st-top); padding: 0 8px 0 4px; gap: 6px; }
  .studio-form, .studio-preview { flex: 1 1 0; min-height: 0; }
  .studio-form { border-right: 0; }
  .studio-tabs {
    order: 10; flex: 0 0 auto;
    flex-direction: row; justify-content: space-around; gap: 2px;
    width: auto; padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line);
  }
  .studio-tab { flex: 1 1 0; padding: 7px 2px 6px; font-size: 10.5px; }
  .st-marque, .st-type, .st-complet, .st-droite .badge { display: none; }
  .st-nom { flex: 1 1 auto; margin-left: 0; }
  .st-nom-champ { width: 100%; }
  .preview-scroll { padding: 16px; }
  .preview-bar { padding-left: 12px; }
}
@media (max-width: 560px) {
  .studio-top .save-state span, .st-menu > summary span, .pv-fp { display: none; }
  .st-menu > summary { padding: 0 10px; }
  .st-menu > summary svg:last-child { display: none; }
  .st-modeles { gap: 10px; }
}


/* ---------------------------------------------------------------------------
   Galeries par metier et par offre (lib/catalogue.js). En app.css et non en
   pages.css : l'etape de choix du modele, dans l'espace connecte, s'en sert
   aussi, et cet espace ne charge que app.css.
   --------------------------------------------------------------------------- */
.metier-choix { align-items: center; }
.metier-choix .metier-select { width: auto; min-width: 260px; max-width: 100%; height: 36px; padding: 0 var(--s3); font-size: var(--fs-sm); }
.metier-choix .cat-clear { margin-left: var(--s2); font-size: var(--fs-xs); text-decoration: underline; }
@media (max-width: 640px) {
  .metier-choix { flex-wrap: wrap; }
  .metier-choix .metier-select { min-width: 0; flex: 1 1 100%; }
}

.tpl-badges { display: inline-flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.badge-offre { letter-spacing: .02em; }
.badge-offre.offre-pro     { background: #e8f1fb; color: #1f5a96; }
.badge-offre.offre-max     { background: #e9f7ef; color: #1c7a4a; }
.badge-offre.offre-ultra   { background: #f1ecfb; color: #5b3aa6; }
.badge-offre.offre-premium { background: #fbf2de; color: #8a5a0b; }

.pagination { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: center; align-items: center; margin: var(--s8) 0 var(--s4); }
.pagination-ellipse { color: var(--muted); padding: 0 var(--s1); }
