/* ============================================================================
   Tirage — KDP Studio · design system repris de la maquette
   Palette : crème #F4EFE4 · encre #1A1A17 · marine #1B2A4A · orange #C4571F
   Typos  : Instrument Serif (titres) · Instrument Sans (texte) · IBM Plex Mono
   ========================================================================== */

:root {
  --bg: #F4EFE4;
  --paper: #FFFDF8;
  --paper-soft: #FAF6EC;
  --ink: #1A1A17;
  --ink-soft: #5C564C;
  --muted: #6E685C;
  --faint: #8C8574;
  --fainter: #A09781;
  --line: #E2D9C7;
  --line-soft: #EFE7D7;
  --line-fainter: #F2EBDC;
  --chip-bg: #EAE2D1;
  --chip-bg-2: #E7DFCE;
  --navy: #1B2A4A;
  --navy-deep: #132038;
  --navy-ink: #F7F2E7;
  --accent: #C4571F;
  --accent-soft: #FDF0DF;
  --green: #4A6640;
  --green-soft: #E4EDE0;
  --green-dot: #7A9E6E;
  --warn-bg: #FDF3E4;
  --warn-line: #E9C9A0;
  --console: #14181C;
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'Instrument Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--navy); text-decoration: none; border-bottom: 1px solid rgba(27,42,74,.3); }
a:hover { color: var(--accent); border-bottom-color: var(--accent); }
input[type=range] { accent-color: var(--navy); width: 100%; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #D9D0BE; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.serif { font-family: var(--serif); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.tnum { font-variant-numeric: tabular-nums; }

/* ── Amorce ── */
.boot-splash { min-height: 100vh; display: grid; place-items: center; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 7px; background: var(--navy);
  display: grid; place-items: center; color: var(--bg);
  font-family: var(--serif); font-size: 19px; line-height: 1;
}
.logo-mark-lg { width: 54px; height: 54px; border-radius: 12px; font-size: 34px; animation: blink 1.4s infinite; }
.logo-name { font-family: var(--serif); font-size: 23px; letter-spacing: -.01em; }

/* ── Étiquettes / boutons génériques ── */
.kicker {
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--accent);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 9px; font-size: 13.5px; font-weight: 500;
  cursor: pointer; border: none; font-family: var(--sans); user-select: none;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn-primary { background: var(--navy); color: var(--navy-ink); }
.btn-primary:hover { background: var(--navy-deep); }
.btn-ghost { background: var(--paper); border: 1px solid #D9CFBB; color: var(--ink); }
.btn-ghost:hover { border-color: var(--navy); }
.btn-soft { background: var(--chip-bg); color: var(--ink); }
.btn-soft:hover { background: #E0D6C0; }
.btn-light { background: var(--bg); color: var(--navy); }
.btn-outline-light { background: transparent; border: 1px solid rgba(239,231,216,.28); color: var(--navy-ink); }
.btn-outline-light:hover { border-color: #EFE7D8; }
.btn[disabled] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn .spinner {
  width: 14px; height: 14px; border-radius: 99px; border: 2px solid currentColor;
  border-top-color: transparent; animation: spin .8s linear infinite;
}

.chip {
  padding: 6px 11px; border-radius: 7px; font-size: 12.5px; cursor: pointer;
  border: 1px solid var(--line); background: var(--paper-soft); color: var(--ink-soft);
}
.chip.on { border-color: var(--navy); background: var(--navy); color: var(--navy-ink); }
.chip-dashed {
  padding: 6px 11px; border: 1px dashed #D6CCB8; border-radius: 99px;
  font-size: 12.5px; color: var(--muted); cursor: pointer; background: var(--paper-soft);
}
.chip-dashed:hover { border-color: var(--accent); color: var(--accent); }

.badge {
  padding: 3px 8px; border-radius: 6px; font-size: 10.5px; letter-spacing: .05em;
  text-transform: uppercase; white-space: nowrap;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-neutral { background: var(--line-soft); color: var(--muted); }
.badge-orange { background: var(--accent-soft); color: var(--accent); }
.badge-wait { background: var(--line-fainter); color: var(--fainter); }

.note { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; font-size: 13px; margin: 10px 0; line-height: 1.5; }
.note-ok { background: var(--green-soft); color: var(--green); }
.note-warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--ink); }

input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--paper-soft); font-family: var(--sans); font-size: 13.5px; color: var(--ink);
  outline: none;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--navy); }
label { display: block; font-size: 13px; font-weight: 500; }
label > input, label > textarea, label > select { margin-top: 7px; font-weight: 400; }

/* ── Connexion ── */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 420px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 16px; padding: 30px; animation: fadeUp .3s ease;
}
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-form { display: grid; gap: 14px; margin-top: 18px; }
.auth-form .btn { margin-top: 6px; }

/* ── En-tête application ── */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center;
  justify-content: space-between; gap: 24px; padding: 0 32px; height: 66px;
  background: rgba(244,239,228,.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-sep { width: 1px; height: 20px; background: #DCD2BE; }
.topbar-project { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); min-width: 0; }
.topbar-project .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.tag {
  padding: 2px 7px; border-radius: 5px; background: var(--chip-bg-2); font-size: 11px;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
.topbar-right { display: flex; align-items: center; gap: 18px; }
.step-indicator { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.connector-btn {
  padding: 7px 13px; border: 1px solid var(--line); border-radius: 99px; background: var(--paper);
  font-size: 12.5px; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.connector-btn:hover { border-color: var(--navy); color: var(--ink); }
.connector-btn.on { border-color: var(--navy); background: var(--navy); color: var(--navy-ink); }
.user-pill {
  display: flex; align-items: center; gap: 9px; padding: 5px 12px 5px 6px;
  border: 1px solid var(--line); border-radius: 99px; background: var(--paper); cursor: pointer;
}
.user-pill .avatar {
  width: 24px; height: 24px; border-radius: 99px; background: var(--accent); color: #FFF8EE;
  display: grid; place-items: center; font-size: 11px; font-weight: 600;
}
.user-pill span { font-size: 13px; }

/* ── Onglets d'étapes ── */
.steps-bar {
  display: flex; gap: 0; padding: 0 32px; background: var(--paper);
  border-bottom: 1px solid var(--line); overflow-x: auto;
}
.step-tab {
  display: flex; align-items: center; gap: 9px; padding: 15px 18px; cursor: pointer;
  border-bottom: 2px solid transparent; color: #A8A08C; white-space: nowrap;
}
.step-tab .num { font-family: var(--mono); font-size: 11px; opacity: .55; }
.step-tab .lbl { font-size: 13.5px; }
.step-tab .dot { width: 6px; height: 6px; border-radius: 99px; background: #DCD2BE; }
.step-tab.done { color: var(--muted); }
.step-tab.done .dot { background: var(--green-dot); }
.step-tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.step-tab.active .dot { background: var(--accent); }
.step-tab.locked { cursor: default; opacity: .6; }

/* ── Mise en page générale ── */
.page { max-width: 1180px; margin: 0 auto; padding: 44px 32px 130px; animation: fadeUp .25s ease; }
.page-head h1 { font-family: var(--serif); font-size: 46px; line-height: 1.05; letter-spacing: -.02em; margin: 0 0 12px; }
.page-head p.lead { font-size: 16px; line-height: 1.55; color: var(--muted); margin: 0; text-wrap: pretty; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.card-pad { padding: 22px; }

/* ── Barre de pied ── */
.footer-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex;
  align-items: center; justify-content: space-between; gap: 20px; padding: 14px 32px;
  background: rgba(255,253,248,.94); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
}
.footer-bar .info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.footer-bar .key { font-size: 12.5px; color: var(--faint); flex: none; }
.footer-bar .val {
  font-family: var(--serif); font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.footer-bar .actions { display: flex; align-items: center; gap: 10px; }

/* ── Tableau de bord projets ── */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 28px; }
.project-card { cursor: pointer; padding: 20px; transition: border-color .15s, box-shadow .15s; }
.project-card:hover { border-color: var(--navy); }
.project-card .title { font-family: var(--serif); font-size: 21px; line-height: 1.15; }
.project-card .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--faint); }
.project-new {
  border: 1px dashed #CFC4AC; background: transparent; display: grid; place-items: center;
  min-height: 130px; color: var(--muted); font-size: 14px; border-radius: 14px; cursor: pointer;
}
.project-new:hover { border-color: var(--accent); color: var(--accent); }

/* ── Étape 1 : niche ── */
.mode-toggle { display: flex; gap: 6px; margin: 34px 0 22px; padding: 5px; background: var(--chip-bg); border-radius: 11px; width: fit-content; }
.mode-toggle div { padding: 9px 17px; border-radius: 8px; font-size: 13.5px; cursor: pointer; color: var(--muted); }
.mode-toggle div.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(48,40,26,.1); }

.idea-grid { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 24px; align-items: start; }
.idea-grid textarea { min-height: 132px; padding: 14px 15px; font-size: 15px; }
.idea-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.idea-footer .src { font-size: 12.5px; color: var(--faint); }
.signals { background: var(--navy); color: #EDE5D6; border-radius: 14px; padding: 20px; }
.signals .head { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; opacity: .6; margin-bottom: 12px; }
.signals .row { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(237,229,214,.14); font-size: 13.5px; line-height: 1.4; }
.signals .row:last-child { border-bottom: none; }
.signals .n { opacity: .5; font-family: var(--mono); font-size: 11px; padding-top: 2px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; gap: 14px; flex-wrap: wrap; }
.section-head h2 { font-family: var(--serif); font-size: 26px; margin: 0; }
.section-head .sub { font-size: 12.5px; color: var(--faint); }

.themes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.theme-card { cursor: pointer; padding: 20px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); }
.theme-card.on { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(27,42,74,.09); }
.theme-card .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.theme-card .name { font-family: var(--serif); font-size: 21px; line-height: 1.15; }
.theme-card .cat { font-size: 12.5px; color: var(--faint); margin-top: 4px; }
.theme-card .score { flex: none; padding: 5px 10px; border-radius: 8px; font-family: var(--mono); font-size: 13px; background: var(--chip-bg); color: var(--ink-soft); }
.theme-card .score.hot { background: var(--navy); color: var(--navy-ink); }
.theme-card .why { font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); margin: 12px 0 0; }
.theme-card .metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.metric-label { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--fainter); }
.metric-value { font-size: 13.5px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.demand-track { height: 4px; border-radius: 9px; background: var(--chip-bg); margin-top: 6px; overflow: hidden; }
.demand-fill { height: 100%; background: var(--accent); border-radius: 9px; }

/* ── Étape 2 : concepts ── */
.books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; margin-top: 30px; }
.book-card { cursor: pointer; padding: 20px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); }
.book-card.on { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(27,42,74,.09); }
.book-card .inner { display: flex; gap: 16px; }
.mini-cover {
  flex: none; width: 74px; height: 111px; border-radius: 3px; padding: 12px 8px;
  display: flex; flex-direction: column; justify-content: center;
}
.mini-cover .t { font-family: var(--serif); font-size: 12.5px; line-height: 1.15; text-align: center; }
.mini-cover .rule { width: 18px; height: 1px; background: currentColor; opacity: .5; margin: 7px auto; }
.mini-cover .brand { font-size: 7.5px; letter-spacing: .1em; text-transform: uppercase; text-align: center; opacity: .7; }
.mini-cover.v0 { background: var(--navy); color: #EFE7D8; }
.mini-cover.v1 { background: var(--accent); color: #FFF6EA; }
.mini-cover.v2 { background: var(--chip-bg-2); color: #3A3529; }
.book-card .num { font-family: var(--mono); font-size: 10.5px; color: var(--fainter); }
.book-card .title { font-family: var(--serif); font-size: 22px; line-height: 1.12; letter-spacing: -.01em; }
.book-card .hook { font-family: var(--serif); font-style: italic; font-size: 15.5px; color: var(--accent); margin-top: 5px; line-height: 1.3; }
.book-card .desc { font-size: 13px; line-height: 1.55; color: var(--ink-soft); margin: 10px 0 0; }
.book-card .stats { display: flex; gap: 18px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.book-card .stats strong { color: var(--ink); font-weight: 500; }

/* ── Étape 3 : sommaire ── */
.toc-grid { display: grid; grid-template-columns: 328px minmax(0,1fr); gap: 24px; align-items: start; }
.params-card { position: sticky; top: 132px; }
.params-card .title { font-size: 14px; font-weight: 600; margin-bottom: 18px; }
.param-row-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 9px; font-size: 13px; }
.param-row-head .mono { font-size: 14px; }
.range-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--fainter); margin-top: 4px; }
.photos-box { padding: 15px; border-radius: 11px; background: var(--paper-soft); border: 1px solid var(--line-soft); margin: 22px 0 18px; }
.photos-box .head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.photos-box .sub { font-size: 12px; color: var(--faint); margin-top: 2px; }
.switch { width: 42px; height: 24px; border-radius: 99px; padding: 3px; cursor: pointer; display: flex; background: #DCD2BE; transition: background .15s; flex: none; }
.switch.on { background: var(--navy); justify-content: flex-end; }
.switch .knob { width: 18px; height: 18px; border-radius: 99px; background: var(--paper); }
.photos-detail { margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.photos-detail .row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 12.5px; }
.photos-hint { font-size: 11.5px; color: var(--faint); margin-top: 11px; line-height: 1.45; }
.param-label { font-size: 12.5px; margin-bottom: 6px; color: var(--muted); }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }

.toc-card { overflow: hidden; }
.toc-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--line-soft); gap: 14px; }
.toc-head .t { font-family: var(--serif); font-size: 22px; }
.toc-head .sub { font-size: 12.5px; color: var(--faint); margin-top: 2px; }
.toc-head .target { font-family: var(--mono); font-size: 12px; color: var(--faint); white-space: nowrap; }
.toc-row { display: flex; gap: 16px; padding: 17px 24px; border-bottom: 1px solid var(--line-fainter); }
.toc-row:last-child { border-bottom: none; }
.toc-row .num { width: 26px; flex: none; font-family: var(--mono); font-size: 12px; color: #B4AB94; padding-top: 3px; }
.toc-row .title { font-family: var(--serif); font-size: 19px; line-height: 1.2; cursor: text; border-radius: 6px; padding: 1px 4px; margin-left: -4px; }
.toc-row .title:hover { background: var(--paper-soft); }
.toc-row .title:focus { outline: 2px solid var(--navy); background: var(--paper-soft); }
.toc-parts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.toc-part { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 6px;
  background: var(--bg); font-size: 12px; color: var(--muted); }
.toc-part [contenteditable]:focus { outline: none; box-shadow: 0 1px 0 var(--accent); }
.toc-part .x { cursor: pointer; color: var(--fainter); font-size: 10px; opacity: 0; transition: opacity .15s; }
.toc-row:hover .toc-part .x { opacity: 1; }
.toc-part .x:hover { color: var(--accent); }
.toc-part.add { cursor: pointer; background: none; border: 1px dashed var(--line); color: var(--fainter); }
.toc-part.add:hover { border-color: var(--accent); color: var(--accent); }
.toc-side { flex: none; text-align: right; font-size: 12px; color: var(--fainter); font-variant-numeric: tabular-nums; }
.toc-side .visuals { margin-top: 4px; color: var(--accent); }
.toc-move { display: flex; flex-direction: column; gap: 2px; opacity: 0; transition: opacity .15s; }
.toc-row:hover .toc-move { opacity: 1; }
.toc-move span { cursor: pointer; font-size: 11px; color: var(--fainter); padding: 1px 5px; border-radius: 5px; }
.toc-move span:hover { background: var(--chip-bg); color: var(--ink); }
.toc-move span.del:hover { background: rgba(196,87,31,.12); color: var(--accent); }
.toc-empty { padding: 48px 24px; text-align: center; color: var(--faint); font-size: 13.5px; }

/* Langue du livre : bandeau de l'étape 01 */
.lang-picker { display: flex; align-items: center; justify-content: space-between; gap: 18px;
  margin: 18px 0 4px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--paper-soft); }
.lang-picker .t { font-size: 13.5px; font-weight: 600; }
.lang-picker .sub { font-size: 12px; color: var(--faint); margin-top: 3px; max-width: 620px; line-height: 1.5; }
.lang-picker select { width: auto; min-width: 190px; }
@media (max-width: 760px) { .lang-picker { flex-direction: column; align-items: stretch; } }

.card-actions .danger { color: var(--accent); }
.card-actions .danger:hover { color: #A33C10; }

/* ── Étape 4 : couverture ── */
.cover-grid { display: grid; grid-template-columns: 330px minmax(0,1fr); gap: 24px; align-items: start; }
.cover-templates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cover-template { cursor: pointer; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--paper-soft); }
.cover-template.on { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(27,42,74,.09); }
.cover-template img, .cover-template .thumb { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; }
.cover-template .nm { font-size: 11.5px; padding: 7px 9px; border-top: 1px solid var(--line-soft); text-align: center; color: var(--muted); }
.palette-row { display: flex; gap: 8px; align-items: center; }
.palette-row input[type=color] {
  width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 2px;
  background: var(--paper-soft); cursor: pointer;
}
.cover-preview-zone { background: #E8E1D3; border-radius: 14px; padding: 30px; display: flex; gap: 26px; justify-content: center; flex-wrap: wrap; }
.cover-face { filter: drop-shadow(0 18px 34px rgba(48,40,26,.22)); }
.cover-face svg { display: block; height: auto; }
.cover-face-label { text-align: center; font-size: 12px; color: #7E7768; margin-top: 12px; }

/* ── Étape 5 : rédaction ── */
.writing-grid { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 24px; align-items: start; }
.run-hero { background: var(--navy); color: #EFE7D8; border-radius: 16px; padding: 28px 28px 24px; }
.run-hero .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.run-hero .kicker { opacity: .6; color: #EFE7D8; }
.run-hero .title { font-family: var(--serif); font-size: 34px; line-height: 1.1; margin-top: 10px; }
.run-hero .status { font-size: 13.5px; opacity: .7; margin-top: 6px; }
.run-hero .pct { font-family: var(--mono); font-size: 44px; line-height: 1; letter-spacing: -.02em; }
.run-hero .pct-label { font-size: 12px; opacity: .6; margin-top: 4px; text-align: right; }
.progress-track { height: 7px; border-radius: 9px; background: rgba(255,255,255,.14); margin-top: 24px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 9px; transition: width .6s ease; }
.run-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 22px; padding-top: 20px; border-top: 1px solid rgba(239,231,216,.15); }
.run-stats .k { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; opacity: .55; }
.run-stats .v { font-family: var(--mono); font-size: 19px; margin-top: 5px; }
.run-actions { display: flex; gap: 10px; margin-top: 24px; }

.incident {
  display: flex; gap: 14px; align-items: flex-start; margin-top: 16px; padding: 18px 20px;
  background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 13px;
}
.incident .ic { width: 22px; height: 22px; flex: none; border-radius: 99px; background: var(--accent); color: #FFF8EE; display: grid; place-items: center; font-size: 13px; font-weight: 600; }
.incident .t { font-size: 14px; font-weight: 600; }
.incident .d { font-size: 13px; color: var(--muted); line-height: 1.5; margin-top: 4px; }
.incident .close { font-size: 13px; color: var(--faint); cursor: pointer; padding: 2px 6px; }

.chapters-progress { margin-top: 26px; }
.chapters-progress .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 12px; }
.chapter-run-card { padding: 16px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); }
.chapter-run-card.run { border-color: var(--warn-line); }
.chapter-run-card.wait { opacity: .62; }
.chapter-run-card .head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chapter-run-card .ch { font-family: var(--mono); font-size: 11px; color: var(--fainter); }
.chapter-run-card .title { font-family: var(--serif); font-size: 16.5px; line-height: 1.22; margin-top: 9px; }
.chapter-run-card .track { height: 3px; border-radius: 9px; background: var(--chip-bg); margin-top: 12px; overflow: hidden; }
.chapter-run-card .fill { height: 100%; border-radius: 9px; background: var(--accent); }
.chapter-run-card.done .fill { background: var(--green-dot); }
.chapter-run-card .nums { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11.5px; color: var(--fainter); font-variant-numeric: tabular-nums; }

.console-panel { background: var(--console); border-radius: 14px; padding: 18px; position: sticky; top: 132px; }
.console-panel .head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.console-panel .live-dot { width: 7px; height: 7px; border-radius: 99px; background: #7BC47F; animation: blink 1.4s infinite; }
.console-panel .live-dot.paused { background: #E8B168; animation: none; }
.console-panel .label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #8C9AA6; }
.console-log { font-family: var(--mono); font-size: 11.5px; line-height: 1.75; color: #A9BCC9; max-height: 430px; overflow: auto; }
.console-log .row { display: flex; gap: 9px; }
.console-log .t { color: #4E6070; flex: none; }
.console-log .ok { color: #C9DCE8; }
.console-log .dim { color: #6E7F8C; }
.console-log .warn { color: #E8B168; }
.console-log .err { color: #E88B68; }

/* ── Étape 6 : relecture ── */
.reader-grid { display: grid; grid-template-columns: 288px minmax(0,1fr) 268px; gap: 0; min-height: calc(100vh - 116px); animation: fadeUp .25s ease; }
.reader-nav { border-right: 1px solid var(--line); background: var(--paper); padding: 22px 0 60px; }
.reader-nav .head { padding: 0 20px 16px; }
.reader-nav .book-title { font-family: var(--serif); font-size: 20px; line-height: 1.2; margin-top: 8px; }
.reader-nav .meta { font-size: 12px; color: var(--faint); margin-top: 6px; }
.reader-nav-item { display: flex; gap: 10px; padding: 11px 20px; cursor: pointer; border-left: 2px solid transparent; }
.reader-nav-item:hover { background: var(--paper-soft); }
.reader-nav-item.on { border-left-color: var(--accent); background: var(--bg); }
.reader-nav-item .n { font-family: var(--mono); font-size: 11px; color: #B4AB94; flex: none; padding-top: 2px; }
.reader-nav-item .t { font-size: 13.5px; line-height: 1.35; }

.reader-body { padding: 48px 28px 100px; overflow: hidden; }
.reader-inner { max-width: 640px; margin: 0 auto; }
.reader-inner .chapter-kicker { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--fainter); }
.reader-inner h1 { font-family: var(--serif); font-size: 40px; line-height: 1.08; letter-spacing: -.02em; margin: 12px 0 28px; }
.reader-inner h3.sec { font-family: var(--serif); font-size: 24px; margin: 34px 0 14px; }
.reader-prose { font-family: var(--serif); font-size: 19.5px; line-height: 1.62; color: #26241E; text-wrap: pretty; }
.reader-prose p { margin: 0 0 20px; }
.reader-callout {
  margin: 26px 0; padding: 16px 18px 17px; background: var(--paper-soft);
  border-left: 4px solid var(--accent); border-radius: 0 10px 10px 0;
  font-family: var(--sans);
}
.reader-callout .rc-label {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 8px;
}
.reader-callout p { font-size: 14.5px; line-height: 1.6; color: var(--ink); margin: 0 0 8px; }
.reader-callout p:last-child { margin-bottom: 0; }
.reader-callout.k-retenir   { border-left-color: var(--navy);  background: #EFF0F4; }
.reader-callout.k-chiffre   { border-left-color: var(--accent); background: var(--accent-soft); }
.reader-callout.k-conseil   { border-left-color: var(--green);  background: var(--green-soft); }
.reader-callout.k-exemple   { border-left-color: #8A4B6B;       background: #F5EEF2; }
.reader-callout.k-faq       { border-left-color: var(--navy);   background: var(--bg); }
.reader-callout.k-attention { border-left-color: #A03D2E;       background: #FAECE8; }
.card-actions { display: flex; gap: 14px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 11.5px; color: var(--faint); font-family: var(--sans); }
.card-actions span { cursor: pointer; }
.card-actions span:hover { color: var(--accent); }
.face-switch { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.face-switch > span { padding: 6px 13px; border-radius: 999px; font-size: 12.5px; cursor: pointer; background: #F1EADA; color: var(--muted); font-family: var(--sans); }
.face-switch > span.on { background: var(--navy); color: #F7F2E7; }
.face-switch .hint { background: none !important; color: var(--faint) !important; font-size: 11px; cursor: default; padding-left: 4px; }
.illus-library { margin-top: 12px; }
.illus-library .lbl { font-size: 11.5px; color: var(--faint); margin-bottom: 7px; }
.illus-library .strip { display: flex; gap: 8px; flex-wrap: wrap; }
.illus-library .item { position: relative; width: 58px; height: 58px; border-radius: 8px; overflow: hidden; border: 2px solid transparent; }
.illus-library .item.on { border-color: var(--accent); }
.illus-library .item img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; display: block; }
.illus-library .item .del { position: absolute; top: 1px; right: 3px; font-size: 10px; color: #FFF; background: rgba(0,0,0,.55); border-radius: 50%; width: 14px; height: 14px; display: grid; place-items: center; cursor: pointer; }
.color-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.color-row label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-family: var(--sans); margin: 0; }
.color-row input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; background: none; }
.cover-swatches { display: flex; align-items: center; gap: 7px; margin-top: 12px; flex-wrap: wrap; }
.cover-swatches .lbl { font-size: 11px; color: var(--faint); margin-right: 2px; }
.cover-swatches .sw { width: 22px; height: 22px; border-radius: 6px; cursor: pointer; border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.cover-swatches .sw.on { border-color: var(--ink); }
/* ── Vos consignes : prioritaires sur tout le reste, visibles partout ────── */
.brief-card { border-left: 3px solid var(--line); transition: border-color .18s ease; }
.brief-card.on { border-left-color: var(--accent); background: #FDFAF5; }
.brief-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.brief-title { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.brief-flag { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 99px; padding: 2px 7px; font-weight: 500; }
.brief-sub { font-size: 11.5px; line-height: 1.55; color: var(--faint); margin-top: 4px; }
.brief-card textarea { width: 100%; font-size: 13px; line-height: 1.6; resize: vertical; }
.brief-foot { display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  margin-top: 7px; font-size: 11.5px; }
.brief-saved { color: var(--green); font-size: 11.5px; white-space: nowrap; }
.brief-applied { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.brief-applied .t { font-size: 11.5px; font-weight: 600; color: var(--green); margin-bottom: 6px; }
.brief-applied .l { font-size: 12px; line-height: 1.55; color: var(--muted); padding-left: 12px;
  position: relative; margin-bottom: 3px; }
.brief-applied .l::before { content: '·'; position: absolute; left: 3px; color: var(--accent); }
.import-brief-link { margin-top: 14px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 10px; cursor: pointer; }
.import-brief-link.on { border-style: solid; border-color: var(--accent); background: #FDFAF5; }
.import-brief-link .t { font-size: 12.5px; font-weight: 600; }
.import-brief-link .q { font-size: 12px; line-height: 1.55; color: var(--muted); margin-top: 5px; font-style: italic; }
.import-brief-link .f { font-size: 11.5px; line-height: 1.5; color: var(--faint); margin-top: 6px; }

.import-summary { margin-top: 14px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.import-summary .row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 4px 0; color: var(--muted); }
.import-modes { display: grid; gap: 8px; }
.import-mode { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 12.5px; line-height: 1.5; }
.import-mode.on { border-color: var(--accent); background: #FBF6EE; }
.import-mode input { margin-top: 2px; accent-color: var(--accent); }
.import-owned { display: flex; gap: 9px; align-items: flex-start; margin-top: 12px; font-size: 12px; color: var(--muted); line-height: 1.5; cursor: pointer; }
.import-owned input { margin-top: 2px; accent-color: var(--accent); }
.custom-cover-note { margin-top: 9px; padding: 9px 11px; background: #EEF5EE; border: 1px solid #CFE0CF; border-radius: 8px; font-size: 11.5px; line-height: 1.5; color: #35502F; }
.custom-cover-card { padding: 14px; margin-bottom: 14px; }
.custom-cover-card .hd { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.custom-cover-card .t { font-size: 13.5px; font-weight: 600; }
.custom-cover-card .sub { font-size: 11.5px; color: var(--faint); margin-top: 3px; }
.custom-cover-card .acts { display: flex; gap: 6px; flex: none; }
.custom-cover-card .acts .btn { padding: 6px 10px; font-size: 11.5px; }
.custom-cover-card .badge { display: inline-block; margin: 4px 0 8px; padding: 3px 9px; border-radius: 20px;
  background: #EEF5EE; border: 1px solid #CFE0CF; color: #35502F; font-size: 11px; }
.custom-cover-card .pdf { display: block; width: 100%; height: 460px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg); }
.custom-cover-card .front { display: block; max-width: 260px; border-radius: 4px;
  box-shadow: 0 8px 24px rgba(48,40,26,.22); }
.custom-cover-card .wrap { display: block; width: 100%; border-radius: 4px; cursor: zoom-in;
  box-shadow: 0 8px 24px rgba(48,40,26,.22); }
.custom-cover-card .fallback { padding: 26px; text-align: center; font-size: 12.5px; color: var(--faint); }
.custom-cover-card .verdict { margin: 4px 0 12px; padding: 11px 13px; border-radius: 9px; font-size: 12px; line-height: 1.55; }
.custom-cover-card .verdict.ok { background: #EEF5EE; border: 1px solid #CFE0CF; color: #2C4A28; }
.custom-cover-card .verdict.attention, .custom-cover-card .verdict.inconnu {
  background: #FDF3E4; border: 1px solid #E9C9A0; color: #6B4415; }
.custom-cover-card .verdict .v { font-weight: 600; margin-bottom: 3px; }
.custom-cover-card .verdict .dims { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px;
  font-size: 11.5px; opacity: .9; }
.custom-cover-card .panels { margin-top: 14px; }
.custom-cover-card .panels .lbl { font-size: 11.5px; color: var(--faint); margin-bottom: 7px; }
.custom-cover-card .panels .strip { display: flex; align-items: flex-end; justify-content: center; gap: 12px; }
.custom-cover-card .panels figure { margin: 0; min-width: 0; text-align: center; }
.custom-cover-card .panels img { height: 190px; width: auto; max-width: 100%; border-radius: 3px;
  box-shadow: 0 4px 14px rgba(48,40,26,.18); }
.custom-cover-card .panels figcaption { font-size: 10.5px; color: var(--fainter); margin-top: 5px;
  text-transform: uppercase; letter-spacing: .08em; }
.custom-cover-card .fallback span { color: var(--accent); cursor: pointer; text-decoration: underline; }

/* ── Génération d'une mise en page : propositions + planche de 7 pages ──── */
.layout-studio { margin-bottom: 24px; padding: 16px 16px 14px; border: 1px solid var(--accent);
  border-radius: 12px; background: #FDFAF5; }
.layout-applied { font-size: 12px; line-height: 1.5; color: var(--green); margin-bottom: 12px;
  padding: 8px 10px; border: 1px solid rgba(31,111,92,.28); border-radius: 8px; background: #F4F9F6; }
.layout-applied .why { color: var(--muted); margin-top: 3px; font-size: 11.5px; }
.layout-props { display: grid; gap: 10px; margin-top: 14px; }
.layout-prop { padding: 12px 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; min-width: 0; }
.layout-prop.on { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(196,87,31,.12); }
.layout-prop .nm { font-size: 13.5px; font-weight: 600; }
/* Classe dédiée : le .badge global impose white-space:nowrap, qui ferait
   déborder le panneau dès que la recette est un peu détaillée. */
.layout-prop .spec { font-size: 10.5px; color: var(--faint); font-family: var(--mono);
  line-height: 1.5; margin-top: 3px; overflow-wrap: anywhere; }
.layout-prop .why { font-size: 12px; line-height: 1.55; color: var(--muted); margin: 7px 0 0; }
.layout-prop .acts { display: flex; gap: 8px; margin-top: 11px; }
.layout-prop .acts .btn { flex: 1; padding: 7px 8px; font-size: 12.5px; white-space: nowrap; }
.planche-bar { display: flex; gap: 16px; align-items: center; justify-content: space-between;
  margin-top: 12px; padding: 12px 14px; border: 1px solid var(--accent); border-radius: 10px;
  background: #FDFAF5; flex-wrap: wrap; }
.planche-bar .txt { font-size: 12.5px; line-height: 1.5; flex: 1; min-width: 240px; }
.planche-bar .why { color: var(--muted); font-size: 12px; margin-top: 4px; }

.layout-composer { margin-bottom: 22px; padding: 16px 16px 10px; background: #FBF8F0; border: 1px solid var(--line); border-radius: 12px; }
.composer-row { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 8px; cursor: pointer; font-size: 12.5px; color: var(--muted); }
.composer-row:hover { background: #F4EDDD; }
.composer-row.on { color: var(--ink); }
.composer-row input { accent-color: var(--accent); width: 15px; height: 15px; flex: none; cursor: pointer; }
.watch-item { display: flex; gap: 8px; padding: 5px 0; font-size: 12.5px; line-height: 1.4; color: inherit; text-decoration: none; border-radius: 6px; }
.watch-item:hover { background: #F6F1E4; }
.watch-item:hover .ttl { color: var(--accent); }
.watch-item .num { color: var(--fainter); flex: none; font-size: 11px; padding-top: 1px; width: 16px; }
.watch-item .ttl { flex: 1; min-width: 0; }
.watch-item .prix { flex: none; color: var(--muted); font-size: 11.5px; text-align: right; line-height: 1.35; }
.watch-item .note { color: var(--fainter); font-size: 10px; }
.toc-request { margin-top: 18px; padding: 16px 18px; border-top: 1px dashed var(--line); }
.toc-request .t { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.toc-request .row { display: flex; gap: 10px; }
.toc-request input { flex: 1; padding: 9px 12px; font-size: 13px; }
.toc-request .hint { margin-top: 8px; font-size: 11.5px; color: var(--faint); }
.section-actions { display: flex; gap: 16px; margin: -6px 0 18px; font-size: 12px; color: var(--faint); font-family: var(--sans); }
.section-actions span { cursor: pointer; }
.section-actions span:hover { color: var(--accent); }
.section-actions .faint { cursor: default; }
.section-actions .faint:hover { color: var(--faint); }
.section-edit { margin: 0 0 18px; }
.section-edit textarea { width: 100%; padding: 12px 14px; font-size: 13.5px; line-height: 1.6; font-family: var(--mono); resize: vertical; }
.section-edit .row { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.section-edit .hint { font-size: 11.5px; color: var(--faint); }
.imagegen-box { margin-top: 10px; padding: 14px; background: #FBF8F0; border: 1px solid var(--line); border-radius: 10px; }
.imagegen-box textarea { width: 100%; padding: 9px 12px; font-size: 13px; resize: vertical; margin-bottom: 10px; }
.imagegen-box .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.imagegen-box .hint { font-size: 11.5px; color: var(--faint); }
.reader-table { border-collapse: collapse; margin: 0 0 22px; width: 100%; font-family: var(--sans); font-size: 14px; }
.reader-table th { text-align: left; background: #F1EADA; border-bottom: 2px solid var(--accent); padding: 8px 10px; font-weight: 600; }
.reader-table td { border-bottom: 1px solid var(--line-soft); padding: 8px 10px; }
.reader-subhead { font-family: var(--serif); font-weight: 400; font-size: 23px; margin: 22px 0 10px; color: var(--ink); }
.reader-list { margin: 0 0 20px; padding-left: 22px; font-family: var(--serif); font-size: 19.5px; line-height: 1.62; color: #26241E; }
.reader-list li { margin-bottom: 8px; }
.reader-figure { margin: 34px 0; }
.reader-figure .slot {
  aspect-ratio: 3/2; border: 1px dashed #CFC4AC; border-radius: 10px; background: #EFE8DA;
  display: grid; place-items: center; text-align: center; padding: 24px; position: relative; overflow: hidden;
}
.reader-figure .slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.reader-figure .slot .cap { font-size: 13.5px; color: var(--muted); }
.reader-figure .slot .spec { font-size: 12px; color: var(--fainter); margin-top: 6px; }
.reader-figure figcaption { font-size: 12.5px; color: var(--faint); margin-top: 9px; }
.reader-figure .upload-link { font-size: 12px; color: var(--accent); cursor: pointer; margin-top: 8px; display: inline-block; }
.reader-pager { display: flex; justify-content: space-between; margin-top: 48px; padding-top: 22px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); gap: 14px; }
.reader-pager span { cursor: pointer; }
.reader-pager span:hover { color: var(--accent); }

.reader-tools { border-left: 1px solid var(--line); background: var(--paper); padding: 22px 20px 60px; }
.reader-tools .title { font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.tool-action {
  display: flex; align-items: center; justify-content: space-between; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 9px; font-size: 13px; cursor: pointer;
  background: var(--paper-soft); margin-bottom: 8px;
}
.tool-action:hover { border-color: var(--navy); }
.tool-action .arrow { color: #B4AB94; }
.quality-list { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line-soft); }
.quality-row { display: flex; align-items: baseline; justify-content: space-between; padding: 7px 0; font-size: 12.5px; border-bottom: 1px solid var(--line-fainter); }
.quality-row .k { color: var(--muted); }
.quality-row .v { font-family: var(--mono); color: var(--ink); }
.quality-row .v.warn { color: var(--accent); }

/* ── Étape 7 : mise en page ── */
.layout-grid { display: grid; grid-template-columns: minmax(0,1fr) 356px; gap: 0; min-height: calc(100vh - 116px); animation: fadeUp .25s ease; }
.layout-preview { padding: 38px 40px 100px; background: #E8E1D3; }
.layout-preview .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.layout-preview .head .t { font-family: var(--serif); font-size: 28px; margin-top: 8px; }
.preview-frame-wrap { display: flex; justify-content: center; }
.preview-frame { border: none; background: transparent; width: 100%; height: 74vh; min-height: 520px; }
.preview-caption { text-align: center; font-size: 12.5px; color: #7E7768; margin-top: 18px; }

.layout-side { border-left: 1px solid var(--line); background: var(--paper); padding: 26px 22px 60px; overflow: auto; }
.layout-side .title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.layout-side .sub { font-size: 12.5px; color: var(--faint); margin-bottom: 20px; }
.spec-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-fainter); }
.spec-row .k { font-size: 13px; color: #4E4840; }
.spec-row .v { font-size: 13px; font-family: var(--mono); text-align: right; }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; }
.check-row .ic { flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 99px; display: grid; place-items: center; font-size: 11px; font-weight: 600; }
.check-row .ic.ok { background: var(--green-soft); color: var(--green); }
.check-row .ic.warn { background: var(--accent-soft); color: var(--accent); }
.check-row .l { font-size: 13px; line-height: 1.35; }
.check-row .n { font-size: 11.5px; color: var(--faint); margin-top: 2px; }

.publish-card { margin-top: 26px; padding: 16px; border-radius: 12px; background: var(--navy); color: #EFE7D8; }
.publish-card .t { font-size: 13px; font-weight: 600; }
.publish-card .d { font-size: 12.5px; opacity: .7; line-height: 1.5; margin-top: 5px; }
.publish-card .btns { display: grid; gap: 8px; margin-top: 14px; }
.publish-card .btn { width: 100%; }

/* ── Éditeur de couverture ── */
.editor-toolbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 10px;
  background: var(--paper-soft); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px;
  min-height: 46px; font-size: 12.5px;
}
.editor-toolbar .tb-sep { width: 1px; height: 22px; background: var(--line); margin: 0 3px; }
.editor-toolbar select, .editor-toolbar input[type=number] {
  width: auto; padding: 5px 7px; font-size: 12px; border-radius: 7px;
}
.editor-toolbar input[type=number] { width: 62px; }
.editor-toolbar input[type=color] { width: 30px; height: 30px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); cursor: pointer; }
.tb-btn {
  padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper);
  cursor: pointer; font-size: 12px; user-select: none; line-height: 1;
}
.tb-btn:hover { border-color: var(--navy); }
.tb-btn.on { background: var(--navy); color: var(--navy-ink); border-color: var(--navy); }
.tb-btn.bold { font-weight: 700; }
.tb-btn.italic { font-style: italic; }
.tb-hint { color: var(--fainter); font-size: 11px; }

.editor-wrap { display: flex; justify-content: center; background: #E8E1D3; border-radius: 12px; padding: 18px; }
#ed-stage {
  position: relative; width: 400px; aspect-ratio: 1600 / 2560; background: #fff;
  box-shadow: 0 14px 34px rgba(48,40,26,.25); overflow: hidden; touch-action: none;
}
#ed-stage .ed-el { position: absolute; box-sizing: border-box; }
#ed-stage .ed-el.draggable { cursor: grab; }
#ed-stage .ed-el.dragging { cursor: grabbing; }
#ed-stage .ed-el.selected { outline: 1.5px solid #2743D0; outline-offset: 0; }
#ed-stage .ed-el .ed-text-inner { width: 100%; overflow-wrap: break-word; white-space: pre-wrap; }
#ed-stage .ed-el[data-editing="1"] { cursor: text; }
.ed-handle {
  position: absolute; width: 10px; height: 10px; background: #2743D0; border: 1.5px solid #fff;
  border-radius: 2px; z-index: 30;
}
.ed-handle.e  { cursor: ew-resize; }
.ed-handle.s  { cursor: ns-resize; }
.ed-handle.se { cursor: nwse-resize; }
.ed-guide { position: absolute; background: #FF2D8A; z-index: 25; pointer-events: none; }
.ed-guide.v { width: 1px; top: 0; bottom: 0; }
.ed-guide.h { height: 1px; left: 0; right: 0; }
.editor-downloads { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.font-preview-row { display: flex; align-items: center; gap: 8px; }
.font-preview { font-size: 17px; line-height: 1; color: var(--ink); white-space: nowrap; }

/* ── Modales ── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(26,26,23,.45);
  display: grid; place-items: center; padding: 24px; animation: fadeUp .15s ease;
}
.modal {
  width: 100%; max-width: 640px; max-height: 88vh; overflow: auto; background: var(--paper);
  border: 1px solid var(--line); border-radius: 16px; padding: 26px;
}
.modal h2 { font-family: var(--serif); font-size: 26px; margin: 0 0 6px; }
.modal .sub { font-size: 13px; color: var(--muted); margin-bottom: 18px; line-height: 1.5; }
.modal .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal .row { margin-bottom: 12px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal pre {
  background: var(--paper-soft); border: 1px solid var(--line-soft); border-radius: 9px;
  padding: 12px; font-family: var(--mono); font-size: 11.5px; overflow: auto; white-space: pre-wrap; word-break: break-all;
}
.token-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-fainter); font-size: 12.5px; }
.kw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 10px;
  font-size: 13.5px; box-shadow: 0 10px 30px rgba(26,26,23,.3); animation: fadeUp .2s ease;
  max-width: min(560px, 90vw); text-align: center;
}
.toast.error { background: #7C2D12; color: #FFF3E9; }

/* ── Responsive ── */
@media (max-width: 1080px) {
  .idea-grid, .toc-grid, .cover-grid, .writing-grid { grid-template-columns: 1fr; }
  .params-card, .console-panel { position: static; }
  .reader-grid { grid-template-columns: 1fr; }
  .reader-nav { border-right: none; border-bottom: 1px solid var(--line); }
  .reader-tools { border-left: none; border-top: 1px solid var(--line); }
  .layout-grid { grid-template-columns: 1fr; }
  .layout-side { border-left: none; border-top: 1px solid var(--line); }
}
@media (max-width: 700px) {
  .page { padding: 28px 18px 150px; }
  .page-head h1 { font-size: 32px; }
  .topbar { padding: 0 16px; }
  .steps-bar { padding: 0 8px; }
  .books-grid { grid-template-columns: 1fr; }
  .footer-bar { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 16px; }
  .footer-bar .actions { justify-content: flex-end; }
}
