/* PDF Facile — Factualis */
:root {
  color-scheme: light;
  --ink: #1d2433;
  --ink-2: #3a4356;
  --muted: #6b7280;
  --bg: #f4f2ed;
  --card: #ffffff;
  --line: #e3dfd6;
  --line-2: #d3cec3;
  --accent: #c8372d;
  --accent-dark: #a02a21;
  --accent-soft: #fbeae8;
  --blue: #2457a6;
  --blue-soft: #e7eefa;
  --green: #1f8a4c;
  --green-soft: #e3f4ea;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(29,36,51,.06), 0 4px 14px rgba(29,36,51,.06);
  --shadow-lg: 0 10px 40px rgba(29,36,51,.18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
svg { display: block; }
[hidden] { display: none !important; }

/* ---------- Barre du haut ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--ink);
  color: #fff;
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand-mark { width: 36px; height: 36px; background: var(--accent); border-radius: 9px; display: grid; place-items: center; }
.brand-mark svg { width: 26px; height: 26px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 19px; letter-spacing: -.2px; }
.brand-text small { font-size: 11.5px; opacity: .7; }
.licence-pill {
  border: 1px solid rgba(255,255,255,.28); background: transparent; color: #fff;
  border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.licence-pill.ok { border-color: rgba(120,220,160,.5); color: #b9f0cf; cursor: default; }
.licence-pill:not(.ok):hover { background: rgba(255,255,255,.1); }

main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 22px 20px 30px; }
.view { display: none; }
.view.active { display: block; }

/* ---------- Accueil ---------- */
.hero { text-align: center; padding: 18px 0 8px; }
.hero h1 { font-size: clamp(26px, 4.4vw, 38px); margin: 0 0 6px; letter-spacing: -.6px; }
.lead { color: var(--muted); margin: 0 0 22px; font-size: 17px; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  max-width: 560px; margin: 0 auto;
  padding: 30px 20px;
  border: 2.5px dashed var(--line-2); border-radius: 20px;
  background: var(--card); cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: #fffaf9; }
.dropzone.over { transform: scale(1.01); }
.dz-icon { width: 62px; height: 62px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; margin-bottom: 4px; }
.dz-icon svg { width: 34px; height: 34px; }
.dz-title { font-size: 21px; font-weight: 700; }
.dz-sub { color: var(--muted); font-size: 14.5px; }

.doccard {
  display: flex; gap: 20px; align-items: center;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; border: 1px solid var(--line);
}
.doccard-thumb { width: 96px; flex: none; }
.doccard-thumb canvas { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.doccard-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.doccard-label { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 600; }
.doccard-name { display: flex; align-items: center; gap: 2px; font-size: 19px; font-weight: 700; }
.doccard-name input { border: 1px solid transparent; border-radius: 6px; padding: 2px 6px; margin-left: -7px; font-weight: 700; min-width: 4ch; flex: 0 1 auto; max-width: 100%; background: transparent; }
.doccard-name input:hover { border-color: var(--line); }
.doccard-name input:focus { outline: none; border-color: var(--blue); background: #fff; }
.doccard-name span { color: var(--muted); font-weight: 500; }
.doccard-meta { color: var(--muted); font-size: 14px; }
.doccard-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.doccard.pulse .btn-primary { animation: pulse 1.4s ease-in-out 3; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(200,55,45,.45); } 50% { box-shadow: 0 0 0 10px rgba(200,55,45,0); } }

.section-title { font-size: 18px; margin: 30px 0 12px; color: var(--ink-2); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.tile {
  display: flex; gap: 14px; align-items: flex-start; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px; cursor: pointer; box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(29,36,51,.12); border-color: var(--line-2); }
.tile:active { transform: translateY(0); }
.tile-icon { width: 48px; height: 48px; flex: none; border-radius: 12px; display: grid; place-items: center; }
.tile-icon svg { width: 27px; height: 27px; }
.tile-text { display: flex; flex-direction: column; gap: 3px; }
.tile-text strong { font-size: 16.5px; }
.tile-text span { font-size: 14px; color: var(--muted); line-height: 1.35; }

.privacy { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--green); font-size: 14px; margin: 30px 0 0; text-align: center; }
.privacy svg { width: 20px; height: 20px; flex: none; }

.foot { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; padding: 16px; font-size: 13px; color: var(--muted); padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.foot a { color: var(--muted); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line-2); background: #fff; color: var(--ink);
  border-radius: var(--radius-sm); padding: 9px 14px; cursor: pointer;
  font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s, opacity .12s;
}
a.btn { text-decoration: none; }
.btn svg { width: 19px; height: 19px; flex: none; }
.btn:hover { background: #f7f5f0; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #2c3548; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(29,36,51,.06); }
.btn-danger { color: var(--accent); }
.btn-danger:hover { background: var(--accent-soft); border-color: #efc2bd; }
.btn-lg { padding: 11px 18px; font-size: 16px; }
.btn-sm { padding: 6px 10px; font-size: 14px; }
.btn.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Écran outil ---------- */
.toolbar-top {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: -6px 0 14px;
}
.toolbar-top h2 { margin: 0; font-size: 21px; flex: 1; min-width: 160px; }
.back { padding-left: 6px; }
.toolbar-top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tool-help { color: var(--muted); margin: -6px 0 14px; font-size: 14.5px; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.actionbar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px; box-shadow: var(--shadow);
  position: sticky; top: 64px; z-index: 30; margin-bottom: 14px;
}
.actionbar .sep { width: 1px; align-self: stretch; background: var(--line); margin: 2px 4px; }
.actionbar .count { font-size: 14px; color: var(--muted); padding: 0 6px; }
.grow { flex: 1; }

/* ---------- Grille de pages (organiser / exporter) ---------- */
.pagegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.pthumb {
  position: relative; background: var(--card); border: 2px solid var(--line); border-radius: 12px;
  padding: 10px 10px 8px; cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: border-color .12s, box-shadow .12s, opacity .12s;
}
.pthumb:hover { border-color: var(--line-2); }
.pthumb.sel { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.pthumb .pbox { aspect-ratio: 1 / 1.1; display: grid; place-items: center; overflow: hidden; }
.pthumb canvas { max-width: 100%; max-height: 100%; box-shadow: 0 1px 4px rgba(0,0,0,.18); background: #fff; transition: transform .2s; }
.pthumb .blank { width: 70%; aspect-ratio: 1/1.414; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.pthumb .pfoot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 13.5px; color: var(--ink-2); }
.pthumb .pnum { font-weight: 700; }
.pthumb .pmini { display: flex; gap: 2px; }
.pthumb .pmini button { border: none; background: transparent; width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.pthumb .pmini button:hover { background: #f0ede6; }
.pthumb .pmini button.del:hover { background: var(--accent-soft); color: var(--accent); }
.pthumb .pmini svg { width: 18px; height: 18px; }
.pthumb .check {
  position: absolute; top: 8px; left: 8px; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--line-2); background: #fff; display: grid; place-items: center; z-index: 2;
}
.pthumb.sel .check { background: var(--blue); border-color: var(--blue); }
.pthumb .check svg { width: 14px; height: 14px; color: #fff; opacity: 0; }
.pthumb.sel .check svg { opacity: 1; }
.sortable-ghost { opacity: .35; }
.sortable-drag { box-shadow: var(--shadow-lg) !important; }

/* ---------- Listes de fichiers (fusion / images) ---------- */
.filelist { display: flex; flex-direction: column; gap: 8px; }
.fileitem {
  display: flex; align-items: center; gap: 12px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; box-shadow: var(--shadow);
}
.fileitem .grip { cursor: grab; color: var(--muted); padding: 6px 2px; touch-action: none; }
.fileitem .grip svg { width: 20px; height: 20px; }
.fileitem .fthumb { width: 54px; height: 64px; flex: none; display: grid; place-items: center; }
.fileitem .fthumb canvas, .fileitem .fthumb img { max-width: 54px; max-height: 64px; box-shadow: 0 1px 3px rgba(0,0,0,.2); background: #fff; transition: transform .2s; }
.fileitem .finfo { flex: 1; min-width: 0; }
.fileitem .fname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fileitem .fmeta { font-size: 13px; color: var(--muted); }
.fileitem .fbtns { display: flex; gap: 2px; }
.iconbtn { border: none; background: transparent; width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.iconbtn:hover { background: #f0ede6; }
.iconbtn.del:hover { background: var(--accent-soft); color: var(--accent); }
.iconbtn svg { width: 20px; height: 20px; }
.addbtn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  border: 2px dashed var(--line-2); border-radius: 12px; background: transparent; padding: 14px; cursor: pointer;
  color: var(--ink-2); font-weight: 600;
}
.addbtn:hover { border-color: var(--blue); color: var(--blue); background: #fff; }
.addbtn svg { width: 20px; height: 20px; }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.side { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 14px; }

/* ---------- Formulaires d'options ---------- */
.opt { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.opt:last-child { margin-bottom: 0; }
.opt > label, .opt-label { font-size: 13px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .5px; }
.seg { display: flex; flex-wrap: wrap; background: #f0ede6; border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: none; background: transparent; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.field { border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 11px; background: #fff; width: 100%; }
.field:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }
.panel h3 { margin: 0 0 12px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.posgrid { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: 28px 34px 28px; gap: 5px; width: 132px; padding: 7px; border: 1.5px solid var(--line-2); border-radius: 6px; background: #fff; }
.posgrid button { height: 28px; border: 1px solid var(--line-2); border-radius: 6px; background: #fff; cursor: pointer; position: relative; }
.posgrid button::after { content: ""; position: absolute; width: 14px; height: 4px; border-radius: 2px; background: var(--line-2); left: 50%; top: 50%; transform: translate(-50%,-50%); }
.posgrid button.on { border-color: var(--accent); background: var(--accent-soft); }
.posgrid button.on::after { background: var(--accent); }
.posgrid .mid { visibility: hidden; }
.preview-box { background: #e9e6df; border-radius: var(--radius); padding: 18px; display: grid; place-items: center; min-height: 320px; }
.preview-box canvas { max-width: 100%; height: auto; box-shadow: 0 2px 12px rgba(0,0,0,.2); background: #fff; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.swatches { display: flex; gap: 6px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }

/* ---------- Éditeur ---------- */
.edit-tools {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: stretch;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px; box-shadow: var(--shadow);
  position: sticky; top: 64px; z-index: 30;
}
.etool {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 78px; padding: 7px 8px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
}
.etool svg { width: 24px; height: 24px; }
.etool:hover { background: #f4f2ec; }
.etool.on { background: var(--ink); color: #fff; }
.etool.sig { color: var(--blue); }
.etool.sig.on { background: var(--blue); color: #fff; }
.props {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 48px;
  padding: 8px 4px; font-size: 14px; color: var(--muted);
}
.props .grp { display: flex; align-items: center; gap: 6px; }
.props select { border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 8px; background: #fff; }
.props .size { min-width: 34px; text-align: center; font-weight: 700; color: var(--ink); }

.pages { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 6px 0 40px; }
.page {
  position: relative; background: #fff; box-shadow: 0 2px 14px rgba(0,0,0,.16);
  touch-action: pan-x pan-y pinch-zoom;
}
.page canvas.render { display: block; width: 100%; height: 100%; }
.page .plabel { position: absolute; left: 0; top: -1px; transform: translateY(-100%); font-size: 12px; color: var(--muted); padding-bottom: 2px; }
.layer { position: absolute; inset: 0; }
.layer.crosshair { cursor: crosshair; touch-action: none; }
.layer.texting { cursor: text; }
.obj { position: absolute; touch-action: none; }
.obj.sel { outline: 2px solid var(--blue); outline-offset: 2px; }
.obj.text > .txt {
  white-space: pre; line-height: 1.2; outline: none; min-width: 6px; cursor: move;
  padding: 0; margin: 0;
}
.obj.text.editing > .txt { cursor: text; }
.obj.text.empty > .txt::before { content: attr(data-ph); color: #9aa1ad; }
.obj.rect { cursor: move; }
.obj.rect.hl { mix-blend-mode: multiply; }
.obj.rect.mask { box-shadow: 0 0 0 1px rgba(36,87,166,.35) inset; }
.obj.img { cursor: move; }
.obj.img img { width: 100%; height: 100%; display: block; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.handle {
  position: absolute; width: 18px; height: 18px; right: -11px; bottom: -11px;
  background: #fff; border: 2px solid var(--blue); border-radius: 50%; cursor: nwse-resize; display: none; touch-action: none;
}
.obj.sel .handle { display: block; }
.obj.text .handle { display: none !important; }
.obj-menu {
  position: absolute; top: -44px; left: -2px; display: none; gap: 2px; background: var(--ink); border-radius: 9px; padding: 3px; z-index: 5;
  white-space: nowrap;
}
.obj.sel .obj-menu { display: flex; }
.obj-menu button { border: none; background: transparent; color: #fff; height: 32px; min-width: 32px; padding: 0 8px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; }
.obj-menu button:hover { background: rgba(255,255,255,.14); }
.obj-menu svg { width: 17px; height: 17px; }
.hint-float {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 999px; font-size: 14.5px; z-index: 40; box-shadow: var(--shadow-lg); pointer-events: none;
  max-width: calc(100vw - 32px); text-align: center;
}

/* Formulaire */
.formfield { position: absolute; }
.formfield input[type=text], .formfield textarea, .formfield select {
  width: 100%; height: 100%; border: 1px solid rgba(36,87,166,.45); background: rgba(231,238,250,.75);
  padding: 0 3px; border-radius: 2px; resize: none; font-family: Helvetica, Arial, sans-serif;
}
.formfield textarea { padding-top: 2px; }
.formfield input:focus, .formfield textarea:focus, .formfield select:focus { outline: 2px solid var(--blue); background: #fff; }
.formfield.chk { display: grid; place-items: center; background: rgba(231,238,250,.75); border: 1px solid rgba(36,87,166,.45); border-radius: 2px; cursor: pointer; }
.formfield.chk.radio { border-radius: 50%; }
.formfield.chk svg { width: 80%; height: 80%; color: var(--ink); opacity: 0; }
.formfield.chk.on svg { opacity: 1; }
.formfield.sigf { display: grid; place-items: center; border: 1.5px dashed var(--blue); background: rgba(231,238,250,.8); color: var(--blue); font-weight: 700; font-size: 13px; cursor: pointer; border-radius: 3px; overflow: hidden; }
.formfield.sigf img { max-width: 100%; max-height: 100%; }
.formfield .ro { opacity: .6; }

/* ---------- Modales ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(20,24,34,.55); z-index: 170;
  display: grid; place-items: center; padding: 16px; animation: fade .15s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 480px;
  max-height: calc(100vh - 32px); overflow: auto; animation: pop .18s ease-out;
}
.modal.wide { max-width: 680px; }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 0; }
.modal-head h3 { margin: 0; font-size: 19px; }
.modal-body { padding: 14px 18px; }
.modal-body p { margin: 0 0 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 18px 18px; flex-wrap: wrap; }

/* Signature */
.sig-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.sig-pad-wrap { position: relative; border: 1.5px solid var(--line-2); border-radius: 12px; background: #fff; overflow: hidden; }
.sig-pad-wrap::after { content: ""; position: absolute; left: 8%; right: 8%; bottom: 28%; border-bottom: 1.5px dashed #cfd4dc; pointer-events: none; }
.sig-pad { display: block; width: 100%; height: 220px; touch-action: none; cursor: crosshair; }
.sig-pad-hint { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; color: #a1a7b2; font-size: 13px; pointer-events: none; }
.sig-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.sig-typed { font-family: "GreatVibes", cursive; font-size: 54px; text-align: center; padding: 22px 8px; min-height: 120px; border: 1.5px solid var(--line-2); border-radius: 12px; overflow: hidden; white-space: nowrap; }
.sig-saved { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.sig-saved .item { position: relative; border: 1.5px solid var(--line-2); border-radius: 10px; padding: 8px; cursor: pointer; background: #fff; height: 80px; display: grid; place-items: center; }
.sig-saved .item:hover { border-color: var(--blue); }
.sig-saved .item img { max-width: 100%; max-height: 62px; }
.sig-saved .item .x { position: absolute; top: 2px; right: 2px; width: 26px; height: 26px; }
@font-face { font-family: "GreatVibes"; src: url("../fonts/great-vibes.woff2") format("woff2"); font-display: swap; }

/* Toasts / occupation */
#toasts { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); }
.toast { background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 15px; animation: pop .2s; max-width: 520px; text-align: center; }
.toast.ok { background: var(--green); }
.toast.err { background: var(--accent); }
#busy { position: fixed; inset: 0; background: rgba(244,242,237,.7); z-index: 150; display: grid; place-items: center; }
.busy-box { background: #fff; border-radius: 14px; padding: 16px 22px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-lg); font-weight: 600; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Licence */
.pay-price { font-size: 34px; font-weight: 800; letter-spacing: -1px; }
.pay-list { margin: 10px 0 14px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.pay-list li { display: flex; gap: 8px; align-items: flex-start; }
.pay-list li::before { content: "✓"; color: var(--green); font-weight: 800; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 16px 0 10px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.code-row { display: flex; gap: 8px; }
.code-row input { text-transform: uppercase; letter-spacing: 1px; }
.msg-err { color: var(--accent); font-size: 14px; margin-top: 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .two-col { grid-template-columns: 1fr; }
  .side { position: static; }
}
@media (max-width: 600px) {
  main { padding: 16px 12px 24px; }
  .topbar { padding-left: 12px; padding-right: 12px; }
  .brand-text small { display: none; }
  .licence-pill { font-size: 12px; padding: 5px 10px; }
  .doccard { flex-direction: column; align-items: stretch; text-align: left; }
  .doccard-thumb { width: 80px; }
  .doccard-actions .btn { flex: 1; }
  .tiles { grid-template-columns: 1fr; gap: 10px; }
  .tile { padding: 14px; }
  .pagegrid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .etool { min-width: 60px; flex: none; font-size: 11.5px; padding: 6px 4px; }
  .etool svg { width: 22px; height: 22px; }
  .edit-tools { top: 56px; gap: 2px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; }
  .edit-tools::-webkit-scrollbar { display: none; }
  .edit-tools .zoom { display: none; }
  .props { font-size: 13px; }
  .doccard-name span { display: none; }
  .doccard-thumb { width: 110px; }
  .actionbar { position: static; }
  .actionbar .btn span { font-size: 13px; }
  .toolbar-top h2 { font-size: 18px; }
  .back span { display: none; }
  .sig-typed { font-size: 40px; }
}

/* Zone de défilement de l'éditeur */
.pages-scroll { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
.pages-scroll .pages { width: max-content; min-width: 100%; }
.zoom { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.zoom span { min-width: 46px; text-align: center; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.secure-note { font-size: 12.5px; color: var(--muted); max-width: 360px; }
