/* =========================================================
   Mon Avenir IA — Application (bibliothèque d'ebooks IA)
   Design system inspiré d'Amplemarket : clair, éditorial,
   taxonomie pastel, typo grotesque en poids restreint.
   ========================================================= */

:root {
  /* Couleurs */
  --phoenix-orange: #e8400d;
  --gradient-hero: radial-gradient(120% 120% at 8% -10%, #ffe3c2 0%, #fff6ec 34%, #f3edff 72%, #eef5ff 100%);
  --midnight-indigo: #10054d;
  --charcoal: #272625;
  --ink: #111111;
  --canvas: #ffffff;
  --cream: #f6f5f3;
  --ash: #6d6c6b;
  --stone: #b1b1af;
  --pearl: #ecebea;

  /* Palette pastel — taxonomie des catégories (fond plat, jamais décoratif) */
  --petal-pink: #ffd7f0;
  --mint-green: #b7efb2;
  --canary-yellow: #ffef99;
  --soft-violet: #e2ddfd;
  --aqua: #99fff9;

  --border: rgba(17, 17, 17, .08);
  --border-strong: rgba(17, 17, 17, .14);

  --radius-btn: 8px;
  --radius-card: 12px;
  --radius-input: 12px;

  --shadow-subtle: rgba(17,17,17,.05) 0 0 0 1px inset;
  --shadow-sm: rgba(17,17,17,.04) 0 1px 2px 0, rgba(17,17,17,.04) 0 4px 8px 0;
  --shadow-xl: rgba(17,17,17,.12) 0 26px 60px -6px, rgba(17,17,17,.04) 0 6px 6px -3px, rgba(17,17,17,.04) 0 1px 1px -.5px;

  --maxw: 1200px;
  --nav-h: 64px;

  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--canvas);
  font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01" on, "cv01" on;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* Typo — poids 400 même en grand (signature) ; 900 réservé au display */
h1, h2, h3, h4 { margin: 0 0 .4em; font-weight: 400; letter-spacing: -.02em; line-height: 1.1; }
.display { font-weight: 900; text-transform: uppercase; letter-spacing: -.03em; line-height: .85; font-size: clamp(2.6rem, 7vw, 5.25rem); }
.h-lg { font-size: clamp(2rem, 4.5vw, 3.5rem); letter-spacing: -.035em; line-height: 1; }
.h { font-size: clamp(1.7rem, 3.4vw, 2.75rem); letter-spacing: -.03em; }
.h-sm { font-size: clamp(1.35rem, 2.4vw, 2.25rem); letter-spacing: -.02em; }
.sub { font-size: 1.5rem; letter-spacing: -.02em; line-height: 1.15; }
.eyebrow { font-size: .625rem; letter-spacing: .04em; text-transform: uppercase; color: var(--ash); font-weight: 500; }
.muted { color: var(--ash); }
.lead { font-size: 1.15rem; color: var(--ash); line-height: 1.5; }

/* Layout */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.section { padding: 72px 0; }
.section--tight { padding: 40px 0; }
.cream { background: var(--cream); }
.dark { background: var(--charcoal); color: #fff; }
.dark .muted, .dark .lead { color: #a7a5a3; }
.indigo { background: var(--midnight-indigo); color: #fff; }
.center { text-align: center; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; }
.row-wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px){ .g4{grid-template-columns:repeat(2,1fr)} .g3{grid-template-columns:repeat(2,1fr)} }
@media (max-width: 620px){ .g4,.g3,.g2{grid-template-columns:1fr} }
.hidden { display: none !important; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: .95rem; font-weight: 500; padding: 11px 16px; border-radius: var(--radius-btn);
  border: 1px solid transparent; cursor: pointer; transition: transform .12s, background .2s, border-color .2s, opacity .2s;
  white-space: nowrap; line-height: 1;
}
/* Sans ce override, [hidden]{display:none} de l'UA perd face à `display:
   inline-flex` ci-dessus (même spécificité, l'auteur l'emporte) → un bouton
   .hidden = true en JS resterait visible. Même piège que .ebook plus bas. */
.btn[hidden] { display: none; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover { background: #000; }
.btn--neutral { background: var(--pearl); color: var(--ink); }
.btn--neutral:hover { background: #e2e1df; }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--pearl); }
.btn--orange { background: var(--phoenix-orange); color: #fff; }
.btn--orange:hover { filter: brightness(1.05); }
.btn--outline { background: transparent; border-color: var(--border-strong); color: var(--ink); }
.btn--outline:hover { background: var(--pearl); }
.btn--lg { padding: 14px 22px; font-size: 1rem; }
.btn--sm { padding: 8px 12px; font-size: .85rem; }
.btn--block { width: 100%; }
.dark .btn--ghost, .indigo .btn--ghost { color: rgba(255,255,255,.7); }
.dark .btn--ghost:hover, .indigo .btn--ghost:hover { background: rgba(255,255,255,.1); color:#fff; }
.dark .btn--outline, .indigo .btn--outline { border-color: rgba(255,255,255,.25); color:#fff; }
.dark .btn--outline:hover, .indigo .btn--outline:hover { background: rgba(255,255,255,.1); }

/* Badges / pills */
.pill { display:inline-flex; align-items:center; gap:6px; font-size:.75rem; font-weight:500; padding:5px 11px; border-radius:9999px; background: var(--pearl); color: var(--ink); }
.pill--outline { background: transparent; border: 1px solid var(--border); color: var(--ash); }
.tag { display:inline-flex; align-items:center; gap:6px; font-size:.75rem; padding:4px 10px; border-radius:9999px; color: var(--ink); }

/* Champs */
.field { display:block; margin-bottom: 16px; }
.field label { display:block; font-size:.8rem; font-weight:500; margin-bottom:6px; color: var(--ink); }
.input, .select, .textarea {
  width:100%; background:#fff; color: var(--ink); border:1px solid var(--border);
  border-radius: var(--radius-input); padding: 12px 14px; font-size:.95rem; font-family:inherit; outline:none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(17,17,17,.06); }
.textarea { resize: vertical; min-height: 110px; line-height:1.5; }

/* ---------- Navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 100; height: var(--nav-h);
  background: rgba(255,255,255,.72); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav__in { height:100%; display:flex; align-items:center; justify-content:space-between; gap:20px; }
.brand { display:flex; align-items:center; gap:10px; font-weight:500; letter-spacing:-.02em; font-size:1.05rem; }
.brand__mark { width:32px; height:32px; border-radius:9px; display:grid; place-items:center; background: var(--ink); color:#fff; font-weight:700; font-size:.85rem; }
.brand__mark--orange { background: var(--phoenix-orange); }
.brand__logo { width:32px; height:32px; border-radius:9px; object-fit:cover; flex:none; }
.nav__links { display:flex; align-items:center; gap:4px; }
.nav__links a { padding:8px 12px; border-radius: var(--radius-btn); font-size:.92rem; color: var(--ink); font-weight:450; }
.nav__links a:hover { background: var(--pearl); }
.nav__links a.active { background: var(--pearl); }
/* Un lien stylé en bouton dans le menu garde la couleur du bouton
   (sinon `.nav__links a` écrase le blanc de .btn--primary → texte invisible) */
.nav__links a.btn--primary { color:#fff; }
.nav__links a.btn--primary:hover { background:#000; }
.nav__right { display:flex; align-items:center; gap:8px; }
.nav__toggle { display:none; background:none; border:0; padding:8px; cursor:pointer; color:var(--ink); }
.nav__toggle svg { width:24px; height:24px; }
.avatar { width:32px; height:32px; border-radius:9999px; display:grid; place-items:center; background: var(--soft-violet); color: var(--ink); font-weight:600; font-size:.85rem; cursor:pointer; border:1px solid var(--border); }
/* Bloc actions compte : visible seulement dans le menu mobile déroulé */
.nav__auth-m { display:none; }
@media (max-width: 860px){
  .nav__links, .nav__right .desktop-only { display:none; }
  .nav__toggle { display:block; }
  .nav--open .nav__links {
    display:flex; flex-direction:column; align-items:stretch; position:absolute; top:var(--nav-h); left:0; right:0;
    background:#fff; border-bottom:1px solid var(--border); padding:10px; gap:2px; box-shadow: var(--shadow-xl);
    max-height: calc(100vh - var(--nav-h)); max-height: calc(100dvh - var(--nav-h)); overflow-y:auto;
  }
  .nav--open .nav__links > a { padding:13px 14px; font-size:1rem; border-radius:10px; }
  .nav--open .nav__auth-m {
    display:flex; flex-direction:column; gap:8px; margin-top:8px; padding-top:12px; border-top:1px solid var(--border);
  }
  .nav--open .nav__auth-m > a:not(.btn) { padding:13px 14px; font-size:1rem; border-radius:10px; }
  .nav--open .nav__auth-m > a:not(.btn):hover { background: var(--pearl); }
  .nav--open .nav__auth-m > .btn { padding:13px 14px; font-size:1rem; }
}

/* ---------- Hero ---------- */
.hero { background: var(--gradient-hero); border-bottom:1px solid var(--border); }
.hero__in { padding: 84px 0 72px; max-width: 860px; }
.hero .pill { background:#fff; border:1px solid var(--border); }
.hero h1 { margin: 18px 0; }
.hero__search { display:flex; gap:8px; max-width:560px; margin-top:28px; }
.hero__search .input { height:52px; }
@media (max-width:520px){ .hero__search{ flex-direction:column } }

/* ---------- Cartes catégories (taxonomie pastel plate) ---------- */
.cat-tile {
  display:block; border-radius: var(--radius-card); padding: 20px; min-height:132px;
  position:relative; transition: transform .15s; border: 1px solid rgba(17,17,17,.04);
}
.cat-tile:hover { transform: translateY(-3px); }
.cat-tile .emoji { font-size:1.6rem; }
.cat-tile h3 { font-size:1.15rem; margin:10px 0 4px; }
.cat-tile .count { font-size:.8rem; color: rgba(17,17,17,.55); }
/* Vignette catégorie avec image : dégradé + texte blanc pour rester lisible sur une photo */
.cat-tile--img { background-size:cover; background-position:center; }
.cat-tile--img::before { content:""; position:absolute; inset:0; border-radius:inherit; background:linear-gradient(180deg, rgba(0,0,0,0) 35%, rgba(0,0,0,.68) 100%); pointer-events:none; }
.cat-tile--img > * { position:relative; z-index:1; }
.cat-tile--img h3 { color:#fff; }
.cat-tile--img .count { color:rgba(255,255,255,.85) !important; }
.cat-tile--img p { color:rgba(255,255,255,.85) !important; }
.cat-tile--img .btn--neutral { background:rgba(255,255,255,.92); color:var(--ink); }
.cat-tile--img .btn--ghost { color:#fff; }
.cat-tile--img .btn--ghost:hover { background:rgba(255,255,255,.15); }

/* ---------- Carte ebook ---------- */
.ebook {
  background:#fff; border:1px solid var(--border); border-radius: var(--radius-card); overflow:hidden;
  display:flex; flex-direction:column; transition: transform .15s, box-shadow .2s; cursor:pointer;
}
/* Sans ce override, une carte passée à hidden=true par applyLibraryFilters()
   (recherche/tri/filtre boutique) reste visible : `display:flex` ci-dessus
   a la même spécificité que [hidden]{display:none} de l'UA, et l'emporte. */
.ebook[hidden] { display: none; }
.ebook:hover { transform: translateY(-4px); box-shadow: var(--shadow-xl); }
.ebook__cover { aspect-ratio: 3/2; display:grid; place-items:center; font-size:2.6rem; position:relative; }
.ebook__cat { position:absolute; top:12px; left:12px; font-size:.68rem; font-weight:500; padding:4px 10px; border-radius:9999px; background:rgba(255,255,255,.85); }
.ebook__b { padding:16px 18px 18px; display:flex; flex-direction:column; flex:1; }
.ebook__b h3 { font-size:1.05rem; margin-bottom:4px; line-height:1.2; }
/* Titre de carte = vrai lien crawlable (SEO), mais visuellement identique au titre. */
.card-link { color:inherit; text-decoration:none; }
.card-link:hover { text-decoration:underline; }
.ebook__author { font-size:.82rem; color: var(--ash); margin-bottom:10px; }
.ebook__desc { font-size:.88rem; color: var(--ash); line-height:1.45; flex:1; margin-bottom:14px; }
.ebook__foot { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.ebook__meta { font-size:.78rem; color: var(--ash); display:flex; gap:12px; }

/* ---------- Carte pack (réutilise .ebook, accent visuel pour se distinguer
   des guides à l'unité dans la même grille) ---------- */
.pack-card { border-color: var(--phoenix-orange); background: linear-gradient(180deg, rgba(255,138,61,.05), transparent 45%); }
.pack-card .ebook__cat { background: var(--phoenix-orange); color:#fff; }

/* ---------- Sections génériques cartes ---------- */
.card { background:#fff; border:1px solid var(--border); border-radius: var(--radius-card); padding:20px; }
.card--pad { padding:24px; }
.dark .card, .indigo .card { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.12); }

.stat { background:#fff; border:1px solid var(--border); border-radius: var(--radius-card); padding:20px; }
.stat .n { font-size:2.25rem; letter-spacing:-.03em; }
.stat .l { font-size:.85rem; color: var(--ash); }

/* ---------- Filtres ---------- */
.chips { display:flex; gap:8px; flex-wrap:wrap; }
.chip { border:1px solid var(--border); background:#fff; color: var(--ink); font-size:.85rem; font-weight:450; padding:7px 14px; border-radius:9999px; cursor:pointer; transition: all .12s; }
.chip:hover { border-color: var(--border-strong); }
.chip.active { background: var(--ink); color:#fff; border-color: var(--ink); }
/* Barre de recherche/tri/filtre (boutique, bibliothèque) */
.lib-toolbar { display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-bottom:24px; }
.lib-toolbar .input { margin:0; }
.lib-toolbar select { width:auto; flex:0 0 auto; }
@media (max-width:640px){ .lib-toolbar select { flex:1 1 auto; width:100%; } }

/* ---------- Détail ebook ---------- */
.detail { display:grid; grid-template-columns: 320px 1fr; gap:40px; align-items:start; }
@media (max-width:820px){ .detail{ grid-template-columns:1fr; gap:28px } }
.detail__cover { border-radius: var(--radius-card); aspect-ratio:3/4; display:grid; place-items:center; font-size:4rem; position:sticky; top:88px; }
@media (max-width:820px){ .detail__cover { position:static; aspect-ratio:16/10; max-width:340px; } }
.breadcrumb { font-size:.82rem; color: var(--ash); margin-bottom:20px; }
.breadcrumb a:hover { color: var(--ink); }
.toc { list-style:none; margin:0; padding:0; }
.toc li { padding:12px 0; border-bottom:1px solid var(--border); display:flex; gap:12px; align-items:center; }
.toc li:last-child { border:0; }
.toc .num { width:26px; height:26px; border-radius:7px; background: var(--cream); display:grid; place-items:center; font-size:.8rem; flex:none; }

/* ---------- Lecteur ---------- */
.reader {
  height: 100vh; height: 100dvh; display:flex; flex-direction:column; background:#fff;
}
.reader__bar {
  position:sticky; top:0; z-index:50; min-height:56px; background: rgba(255,255,255,.9); backdrop-filter: saturate(180%) blur(16px);
  border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 16px;
  padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
}
.reader__back { flex:none; }
.reader__title { font-size:.9rem; color:var(--ash); text-align:center; flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.reader__tools { display:flex; align-items:center; gap:6px; flex:none; }
.reader__size { display:inline-flex; border:1px solid var(--border); border-radius: var(--radius-btn); overflow:hidden; }
.reader__size-btn { border-radius:0; padding:8px 10px; font-weight:600; }
.reader__size-btn:first-child { border-right:1px solid var(--border); }
.reader__size-minus, .reader__size-plus { font-size:.72em; vertical-align:super; }
.reader__size-plus { font-size:.82em; }
.reader__progress { height:3px; background: var(--pearl); }
.reader__progress > i { display:block; height:100%; background: var(--phoenix-orange); width:0; transition: width .2s; }
.ebook-frame { width:100%; border:0; display:block; background:#fff; flex:1; min-height:0; }
@media (max-width:600px){
  .reader__bar { gap:6px; padding:6px 10px; }
  .reader__label { display:none; }        /* garde ← et 🖨️ seuls, gagne de la place */
  .reader__back, .reader__pdf { padding:8px 10px; }
  .reader__size-btn { padding:8px; }
}
@media (max-width:360px){ .reader__title { display:none; } }
.reader__page { max-width: 720px; margin:0 auto; padding: 56px 24px 120px; }
.reader__page h1 { font-size: clamp(1.8rem,4vw,2.75rem); letter-spacing:-.03em; margin-bottom:8px; }
.reader__page h2 { font-size:1.5rem; margin:40px 0 12px; letter-spacing:-.02em; }
.prose { font-size:1.12rem; line-height:1.75; color:#1c1c1c; }
.prose p { margin:0 0 1.3em; }
.prose ul { margin:0 0 1.3em; padding-left:1.3em; }
.prose li { margin-bottom:.5em; }
.prose strong { font-weight:600; }
.prose blockquote { margin:1.5em 0; padding:12px 20px; border-left:3px solid var(--phoenix-orange); background:#fff; border-radius:0 8px 8px 0; color:#333; }
.reader__nav { display:flex; justify-content:space-between; gap:12px; margin-top:56px; padding-top:28px; border-top:1px solid var(--border); }
.chapter-list { position:fixed; top:56px; bottom:0; left:0; width:300px; background:#fff; border-right:1px solid var(--border); padding:20px; overflow:auto; transform:translateX(-100%); transition:transform .25s; z-index:60; }
.chapter-list.open { transform:none; }
.chapter-list a { display:block; padding:10px 12px; border-radius:8px; font-size:.9rem; color: var(--ash); }
.chapter-list a:hover { background: var(--cream); color: var(--ink); }
.chapter-list a.active { background: var(--cream); color: var(--ink); font-weight:500; }
.reader__scrim { position:fixed; inset:56px 0 0; background:rgba(0,0,0,.3); z-index:55; }

/* ---------- Espace perso ---------- */
.progress-bar { height:6px; background: var(--pearl); border-radius:9999px; overflow:hidden; }
.progress-bar > i { display:block; height:100%; background: var(--ink); }

/* ---------- Admin ---------- */
.admin-layout { display:grid; grid-template-columns: 220px 1fr; gap:32px; align-items:start; }
/* min-width:0 : sans ça, la colonne de contenu prend la largeur mini du
   tableau (8 colonnes) et déborde sur mobile au lieu de laisser .table-wrap
   défiler horizontalement en interne. */
.admin-layout > * { min-width: 0; }
@media (max-width:860px){ .admin-layout{ grid-template-columns:1fr } }
.admin-nav { position:sticky; top:88px; display:flex; flex-direction:column; gap:2px; }
.admin-nav a { padding:10px 14px; border-radius:8px; font-size:.92rem; color: var(--ash); cursor:pointer; }
.admin-nav a:hover { background: var(--cream); color: var(--ink); }
.admin-nav a.active { background: var(--ink); color:#fff; }
/* Sous-onglets (Lab) */
.subnav { display:flex; gap:4px; flex-wrap:wrap; border-bottom:1px solid var(--border); }
.subnav__tab { padding:9px 16px; border-radius:8px 8px 0 0; font-size:.9rem; color: var(--ash); cursor:pointer; border:1px solid transparent; border-bottom:none; margin-bottom:-1px; }
.subnav__tab:hover { color: var(--ink); background: var(--cream); }
.subnav__tab.active { color: var(--ink); background:#fff; border-color: var(--border); font-weight:500; }
/* Cartes prompt (Lab → Prompts) */
.prompt-list { display:grid; gap:14px; }
.prompt-card { background:#fff; border:1px solid var(--border); border-radius: var(--radius-card); padding:16px 18px; }
.prompt-card[hidden] { display:none; }
.prompt-card__head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; flex-wrap:wrap; margin-bottom:10px; }
.prompt-card__name { margin:0; font-size:1.05rem; word-break:break-word; }
.prompt-card__actions { display:flex; gap:6px; flex-wrap:wrap; flex-shrink:0; }
.prompt-card__content { margin:0; white-space:pre-wrap; word-break:break-word; font-family:ui-monospace,Menlo,monospace; font-size:.82rem; line-height:1.5; color: var(--ash); background: var(--cream); border-radius:8px; padding:12px 14px; max-height:220px; overflow:auto; }
/* Éditeur des pages légales (Lab → Légal & RGPD) */
.legal-editor { border:1px solid var(--border); border-radius: var(--radius-card); background:#fff; margin-bottom:12px; overflow:hidden; }
.legal-editor > summary { list-style:none; cursor:pointer; padding:14px 18px; display:flex; justify-content:space-between; align-items:center; gap:12px; font-weight:500; }
.legal-editor > summary::-webkit-details-marker { display:none; }
.legal-editor > summary:hover { background: var(--cream); }
.legal-editor[open] > summary { border-bottom:1px solid var(--border); }
.legal-editor__body { padding:18px; }
/* Bibliothèque d'un client (modale admin) */
.lib-list { display:flex; flex-direction:column; gap:4px; max-height:200px; overflow:auto; border:1px solid var(--border); border-radius:8px; padding:4px; margin-top:6px; }
.lib-item { display:flex; justify-content:space-between; align-items:center; gap:10px; padding:6px 10px; font-size:.85rem; border-radius:6px; }
/* Sans ce override, un item passé à hidden=true par filterProductPicker()
   reste visible : même piège de spécificité CSS que .ebook[hidden]/.btn[hidden]
   (une règle d'auteur à specificité égale l'emporte sur [hidden] de l'UA). */
.lib-item[hidden] { display:none; }
.lib-item:hover { background: var(--cream); }
/* Upload d'image de couverture (éditeur ebook admin) */
.cover-upload { display:flex; gap:16px; align-items:flex-start; }
.cover-upload__preview { width:120px; height:90px; border-radius:10px; display:grid; place-items:center; font-size:2rem; flex:none; border:1px solid var(--border); overflow:hidden; color:var(--ink); }
.cover-upload__controls { flex:1; min-width:0; }
.cover-upload__controls input[type=file] { display:block; font-size:.82rem; max-width:100%; }
.table { width:100%; border-collapse:collapse; font-size:.9rem; }
.table th { text-align:left; font-weight:500; color: var(--ash); font-size:.78rem; text-transform:uppercase; letter-spacing:.03em; padding:12px; border-bottom:1px solid var(--border); }
.table td { padding:12px; border-bottom:1px solid var(--border); vertical-align:middle; }
.table tr:hover td { background: var(--cream); }
.table-wrap { overflow-x:auto; border:1px solid var(--border); border-radius: var(--radius-card); background:#fff; }

/* ---------- Modal ---------- */
.modal-scrim { position:fixed; inset:0; background:rgba(17,17,17,.4); z-index:200; display:grid; place-items:center; padding:20px; }
.modal { background:#fff; border-radius: var(--radius-card); width:100%; max-width:560px; max-height:90vh; overflow:auto; box-shadow: var(--shadow-xl); }
.modal__head { padding:20px 24px; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; align-items:center; position:sticky; top:0; background:#fff; }
.modal__body { padding:24px; }
.modal__foot { padding:16px 24px; border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:10px; position:sticky; bottom:0; background:#fff; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: calc(100vh - var(--nav-h)); display:grid; place-items:center; padding:40px 20px; background: var(--gradient-hero); }
.auth-card { background:#fff; border:1px solid var(--border); border-radius:16px; padding:36px; width:100%; max-width:420px; box-shadow: var(--shadow-xl); }

/* ---------- Footer ---------- */
.footer { background: var(--charcoal); color:#fff; padding:56px 0 28px; }
.footer a { color: rgba(255,255,255,.6); font-size:.9rem; }
.footer a:hover { color:#fff; }
.footer__grid { display:grid; grid-template-columns:1.6fr 1fr 1fr 1fr; gap:32px; margin-bottom:36px; }
@media (max-width:720px){ .footer__grid{ grid-template-columns:1fr 1fr } }
.footer h4 { font-size:.72rem; text-transform:uppercase; letter-spacing:.05em; color:#a7a5a3; font-weight:500; margin-bottom:14px; }
.footer ul { list-style:none; margin:0; padding:0; }
.footer li { margin-bottom:9px; }
.footer__bottom { border-top:1px solid rgba(255,255,255,.12); padding-top:22px; display:flex; justify-content:space-between; flex-wrap:wrap; gap:10px; color:#8a8886; font-size:.82rem; }

/* Toast */
.toast { position:fixed; bottom:24px; left:50%; transform:translateX(-50%) translateY(20px); background:var(--ink); color:#fff; padding:12px 20px; border-radius:10px; font-size:.9rem; z-index:300; opacity:0; transition:opacity .2s, transform .2s; pointer-events:none; }
.toast.show { opacity:1; transform:translateX(-50%) translateY(0); }

/* Empty state */
.empty { text-align:center; padding:60px 20px; color: var(--ash); }
.empty .emoji { font-size:2.5rem; margin-bottom:12px; }

.reveal { opacity:0; transform:translateY(12px); transition:opacity .5s cubic-bezier(.23,1,.32,1), transform .5s cubic-bezier(.23,1,.32,1); }
.reveal.in { opacity:1; transform:none; }

/* =========================================================
   BOUTIQUE
   ========================================================= */
.price { font-weight:800; letter-spacing:-.02em; color:var(--ink); }
.price-old { color:var(--stone); text-decoration:line-through; font-weight:600; margin-left:8px; font-size:.8em; }
.price-free { color:#047857; font-weight:800; }
.save-pill { background:#ecfdf5; color:#047857; font-weight:700; font-size:.72rem; padding:3px 9px; border-radius:9999px; }
.stars { color:#f59e0b; letter-spacing:1px; font-size:.9rem; }
.rating-row { display:flex; align-items:center; gap:8px; color:var(--ash); font-size:.88rem; }
.owned-badge { background:#ecfdf5; color:#047857; }

/* Carte ebook : pied avec prix */
.ebook__price { font-weight:800; font-size:1.05rem; }

/* Page produit */
.product { display:grid; grid-template-columns: 1fr 360px; gap:44px; align-items:start; }
@media (max-width:860px){ .product { grid-template-columns:1fr; } }
.buybox { position:sticky; top:88px; background:#fff; border:1px solid var(--border); border-radius:16px; padding:22px; box-shadow: var(--shadow-xl); }
.buybox .cover { border-radius:12px; aspect-ratio:16/10; display:grid; place-items:center; font-size:3rem; margin-bottom:18px; }
.buybox .price { font-size:2.1rem; }
.buybox ul { list-style:none; padding:0; margin:18px 0 0; }
.buybox li { display:flex; gap:10px; align-items:flex-start; padding:7px 0; font-size:.86rem; color:var(--ash); }
.buybox li svg { width:17px; height:17px; color:var(--phoenix-orange); flex:none; margin-top:2px; }
.guarantee { text-align:center; font-size:.78rem; color:var(--ash); margin-top:14px; }
@media (max-width:860px){ .buybox { position:static; } }

.learn { list-style:none; padding:0; margin:0; }
.learn li { display:flex; gap:12px; align-items:flex-start; padding:11px 0; border-bottom:1px solid var(--border); }
.learn li:last-child { border:0; }
.learn svg { width:22px; height:22px; color:#16a34a; flex:none; margin-top:1px; }

.review-card { background:#fff; border:1px solid var(--border); border-radius:12px; padding:20px; }
.review-card .who { display:flex; align-items:center; gap:10px; margin-top:14px; }

/* Panier dans la nav */
.nav-cart { position:relative; display:inline-grid; place-items:center; width:40px; height:40px; border-radius:9px; color:var(--ink); }
.nav-cart:hover { background:var(--pearl); }
.nav-cart svg { width:22px; height:22px; }
.cart-badge { position:absolute; top:-2px; right:-2px; background:var(--phoenix-orange); color:#fff; font-size:.62rem; font-weight:700; min-width:18px; height:18px; border-radius:9999px; display:grid; place-items:center; padding:0 4px; }

/* Page panier */
.cart-row { display:flex; gap:16px; align-items:center; padding:14px 16px; border:1px solid var(--border); border-radius:12px; background:#fff; margin-bottom:12px; }
.cart-row .cover { width:64px; height:48px; border-radius:8px; display:grid; place-items:center; font-size:1.5rem; flex:none; }
.cart-summary { background:var(--cream); border-radius:14px; padding:22px; position:sticky; top:88px; }
.cart-line { display:flex; justify-content:space-between; padding:6px 0; font-size:.92rem; }
.cart-total { display:flex; justify-content:space-between; font-weight:800; font-size:1.2rem; border-top:1px solid var(--border-strong); margin-top:10px; padding-top:14px; }

/* Checkout (Stripe simulé) */
.checkout-head { display:flex; align-items:center; gap:8px; }
.stripe-badge { display:inline-flex; align-items:center; gap:6px; font-size:.72rem; color:var(--ash); background:var(--pearl); padding:4px 10px; border-radius:9999px; }
.order-sum { background:var(--cream); border-radius:10px; padding:14px 16px; margin-bottom:18px; }
.order-sum .l { display:flex; justify-content:space-between; padding:4px 0; font-size:.9rem; }
.order-sum .t { display:flex; justify-content:space-between; font-weight:800; border-top:1px solid var(--border-strong); margin-top:8px; padding-top:10px; }
.card-fields { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.card-fields .full { grid-column:1 / -1; }
@media (max-width:440px){ .card-fields { grid-template-columns:1fr; } }
.stripe-note { display:flex; align-items:center; gap:8px; font-size:.78rem; color:var(--ash); margin-top:12px; background:#fffbeb; border:1px solid #fde68a; border-radius:8px; padding:10px 12px; }
.success-check { width:64px; height:64px; border-radius:9999px; background:#ecfdf5; color:#16a34a; display:grid; place-items:center; margin:0 auto 18px; font-size:2rem; }

/* =========================================================
   AVIS / REVIEWS
   ========================================================= */
.reviews-list { display:flex; flex-direction:column; gap:14px; }
.review-reply { background:var(--cream); border-radius:10px; padding:12px 14px; }

.star-input { display:flex; align-items:center; gap:4px; }
.star-btn { background:none; border:0; font-size:1.7rem; line-height:1; color:var(--pearl); cursor:pointer; padding:2px; transition:color .12s, transform .1s; }
.star-btn:hover { color:#f59e0b; transform:scale(1.08); }
.star-btn.active { color:#f59e0b; }

.admin-filters { display:grid; grid-template-columns:1.6fr repeat(4,1fr) auto auto; gap:10px; align-items:center; margin-bottom:8px; }
.admin-filters .input, .admin-filters .select { margin:0; }
@media (max-width:1080px){ .admin-filters{ grid-template-columns:1fr 1fr; } }

.review-dist { padding:16px 20px; }
.review-dist__row { display:grid; grid-template-columns:44px 1fr 32px; align-items:center; gap:12px; font-size:.85rem; padding:5px 0; }
.review-dist__bar { height:8px; background:var(--pearl); border-radius:9999px; overflow:hidden; }
.review-dist__bar > i { display:block; height:100%; background:#f59e0b; }

.review-admin-list { display:flex; flex-direction:column; gap:12px; }
.review-admin { border:1px solid var(--border); border-radius:12px; padding:16px 18px; background:#fff; }
.review-admin.is-hidden { opacity:.6; background:var(--cream); }
.review-admin__top { display:flex; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.review-admin-list--compact .review-admin { padding:12px 14px; }

/* =========================================================
   PAGES LÉGALES
   ========================================================= */
.legal { max-width: 820px; margin: 0 auto; }
.legal h1 { margin-bottom: 8px; }
.legal .updated { color: var(--ash); font-size: .88rem; margin-bottom: 28px; }
.legal h2 { font-size: 1.35rem; letter-spacing: -.01em; margin: 36px 0 10px; }
.legal h3 { font-size: 1.05rem; margin: 22px 0 6px; }
.legal p, .legal li { color: #33322f; line-height: 1.7; }
.legal ul { padding-left: 1.3em; margin: 0 0 1.2em; }
.legal li { margin-bottom: .4em; }
.legal a { color: var(--phoenix-orange); }
.legal__todo { background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px; padding: 16px 20px; margin-bottom: 28px; font-size: .9rem; color: #92400e; }
.legal__todo strong { color: #78350f; }
.fill { background: #fff3cd; border-bottom: 1px dashed #d9a400; padding: 0 3px; font-weight: 600; color: #7a5b00; }

/* =========================================================
   BANDEAU COOKIES
   ========================================================= */
.cookie {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 250;
  max-width: 720px; margin: 0 auto; background: var(--ink); color: #fff;
  border-radius: 14px; padding: 16px 20px; box-shadow: var(--shadow-xl);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.cookie p { margin: 0; font-size: .88rem; color: #e9e8e6; flex: 1; min-width: 240px; line-height: 1.5; }
.cookie a { color: #fff; text-decoration: underline; }
.cookie .row { gap: 8px; }
@media (max-width: 520px){ .cookie { flex-direction: column; align-items: stretch; } }

/* =========================================================
   APERÇU (éditeur admin — modale, contenu complet du formulaire)
   ========================================================= */
.modal--wide { max-width: 860px; }
.preview-frame-wrap { position: relative; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.preview-frame { width: 100%; border: 0; display: block; background: #fff; }

/* =========================================================
   EXTRAIT GRATUIT (page pleine page, #/extrait/:id — voir .reader)
   ========================================================= */
.extract-bar {
  flex: none; border-top: 1px solid var(--border); background: rgba(255,255,255,.95); backdrop-filter: blur(10px);
  padding: 14px 20px; text-align: center;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}
.extract-bar__hint { margin: 0 0 12px; font-size: .85rem; color: var(--ash); }
@media (max-width: 600px){
  .extract-bar { padding: 12px 14px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .extract-bar .btn { flex: 1 1 auto; }
}

/* =========================================================
   PROMOTIONS (campagnes automatiques + codes promo)
   ========================================================= */
/* Prix remisé (remise de campagne active) — accent orange, prix normal barré */
.price-promo { color: var(--phoenix-orange); }
@keyframes price-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.price-promo--anim { display:inline-block; animation: price-pulse 1.1s ease-in-out infinite; transform-origin:left center; }

/* Badge de réduction posé sur une couverture (« -20% ») */
.promo-badge {
  position:absolute; top:12px; right:12px; z-index:2;
  background: var(--phoenix-orange); color:#fff; font-weight:800; font-size:.72rem;
  padding:4px 9px; border-radius:9999px; letter-spacing:-.01em; box-shadow: var(--shadow-sm);
}
.promo-badge--inline { position:static; display:inline-block; font-size:.66rem; padding:2px 7px; vertical-align:middle; }
.buybox .cover { position:relative; }

/* Encart « tu économises X » dans la buy box */
.promo-note {
  background:#ecfdf5; color:#047857; font-weight:600; font-size:.82rem;
  border-radius:8px; padding:8px 12px; margin-bottom:14px;
}

/* Bannière promo site (haut de page) */
.promo-banner {
  background: linear-gradient(90deg, var(--phoenix-orange), #ff7a3d);
  color:#fff; font-weight:500;
}
.promo-banner__in { display:flex; align-items:center; justify-content:center; gap:10px; flex-wrap:wrap; padding:10px 44px 10px 16px; position:relative; text-align:center; }
.promo-banner__txt { font-size:.92rem; }
.promo-banner__count { font-size:.82rem; opacity:.92; font-variant-numeric: tabular-nums; }
.promo-banner__x {
  position:absolute; right:10px; top:50%; transform:translateY(-50%);
  background:rgba(255,255,255,.18); color:#fff; border:0; width:26px; height:26px; border-radius:9999px;
  cursor:pointer; font-size:.8rem; line-height:1; display:grid; place-items:center;
}
.promo-banner__x:hover { background:rgba(255,255,255,.32); }

/* Champ code promo (panier + modale de paiement) */
.promo-row { display:flex; gap:8px; align-items:stretch; }
.promo-row .input { margin:0; text-transform:uppercase; }
.promo-row .btn { flex:none; }
.promo-error { color: var(--phoenix-orange); font-size:.82rem; margin:8px 0 0; }
.promo-applied {
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  background:#ecfdf5; color:#047857; border-radius:10px; padding:8px 8px 8px 14px; font-size:.9rem;
}
.promo-applied strong { font-weight:700; }
.cart-line.promo-line, .order-sum .l.promo-line { color:#047857; font-weight:600; }

/* Grille du panier (contenu + récap) — passe en 1 colonne sur mobile.
   Classe dédiée (et non .detail + style inline) pour que le passage mobile
   fonctionne : un style inline ne peut pas être surchargé par une media query. */
.cart-grid { display:grid; grid-template-columns:1fr 340px; gap:40px; align-items:start; }
@media (max-width:820px){ .cart-grid { grid-template-columns:1fr; gap:24px; } }

/* Admin : sélecteur de produits d'une promo (portée « sélection ») */
.product-picker { margin-bottom:16px; }
.product-picker[hidden] { display:none; }
.product-picker .lib-item input { flex:none; }

/* =========================================================
   RESPONSIVE — POLISH TABLETTE & MOBILE
   (regroupe les ajustements transverses ; les règles ciblées
    d'un composant restent à côté de ce composant plus haut)
   ========================================================= */

/* --- Tablette (≤ 900px) : on resserre les grands espacements --- */
@media (max-width: 900px){
  .section { padding: 52px 0; }
  .section--tight { padding: 32px 0; }
  .hero__in { padding: 60px 0 52px; }
}

/* --- Mobile (≤ 620px) --- */
@media (max-width: 620px){
  .wrap { padding: 0 18px; }
  .section { padding: 40px 0; }
  .section--tight { padding: 26px 0; }
  .hero__in { padding: 44px 0 40px; }
  .hero__search { margin-top: 22px; }
  .hero__search .input { height: 50px; }

  /* Grilles génériques déjà en 1 colonne (voir .g2/.g3/.g4) — on réduit le gap */
  .grid { gap: 16px; }

  /* Cartes & sections plus compactes */
  .card, .card--pad { padding: 18px; }
  .stat { padding: 16px; }
  .stat .n { font-size: 1.9rem; }

  /* Colonnes « sticky » : plus de sticky sur mobile (une seule colonne) */
  .cart-summary, .admin-nav { position: static; }
  .cart-summary { margin-top: 8px; }

  /* Panier : la ligne d'article passe en bloc lisible */
  .cart-row { flex-wrap: wrap; padding: 14px; gap: 10px 14px; }
  .cart-row .price { margin-left: auto; }

  /* Modales : plein cadre, marges réduites */
  .modal-scrim { padding: 10px; align-items: flex-end; }
  .modal { max-height: 92vh; max-height: 92dvh; }
  .modal__head { padding: 16px 18px; }
  .modal__body { padding: 18px; }
  .modal__foot { padding: 14px 18px; }
  .modal__foot .btn { flex: 1; }

  /* Auth */
  .auth-card { padding: 26px 20px; }

  /* Footer */
  .footer { padding: 40px 0 24px; }
  .footer__bottom { flex-direction: column; gap: 8px; }

  /* Barre outils boutique/biblio : la recherche prend toute la largeur */
  .lib-toolbar { gap: 8px; }
  .lib-toolbar .input { flex: 1 1 100%; min-width: 0; }

  /* Fil d'ariane sur une ligne scrollable plutôt que cassé */
  .breadcrumb { white-space: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Sous-onglets Lab : scroll horizontal au lieu de wrap serré */
  .subnav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .subnav__tab { white-space: nowrap; flex: none; }
}

/* --- Très petits écrans (≤ 380px) --- */
@media (max-width: 380px){
  .wrap { padding: 0 14px; }
  .btn { padding: 10px 13px; }
  .brand { font-size: .98rem; }
}
