/* ZNdrip — système de design
   Sol brumeux froid, encre ardoise, vert pin pour l'action. Une seule audace : la dalle « Sauvegarder ma vie numérique ».
   Rayons hiérarchisés : 4px contrôles, 10px panneaux, 20px dalle signature. */

:root {
  --fog: #E9EEF1;
  --paper: #F7F9FA;
  --surface: #FFFFFF;
  --ink: #17252E;
  --ink-2: #4A5C66;
  --ink-3: #7D8D95;
  --line: #D5DEE3;
  --line-2: #C2CDD3;
  --pine: #2F5D50;
  --pine-deep: #1F4239;
  --pine-wash: #DCE8E2;
  --lichen: #C9D8C5;
  --amber: #E8B44C;
  --amber-wash: #F8ECD0;
  --brick: #B4493A;
  --brick-wash: #F5DEDA;
  --on-pine: #F2F7F4;

  /* couleurs de catégories (ruban de stockage) */
  --k-image: #2F5D50;
  --k-video: #6E8F5E;
  --k-document: #A7B97E;
  --k-other: #B9C6CC;

  --font-display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;

  --r-ctl: 4px;
  --r-panel: 10px;
  --r-slab: 20px;
  --nav-h: 64px;
  --side-w: 248px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

:root[data-theme="dark"] { --fog: #10191E; --paper: #142027; --surface: #19272F; --ink: #E3EAEC; --ink-2: #A9B7BD; --ink-3: #74858D; --line: #253740; --line-2: #31454F; --pine: #7FB3A0; --pine-deep: #A3CDBC; --pine-wash: #1D3530; --lichen: #2B4238; --amber-wash: #3A3020; --brick: #E58C7E; --brick-wash: #3B2420; --on-pine: #0E1D18; --k-image: #7FB3A0; --k-video: #5E8A6E; --k-document: #A7B97E; --k-other: #4A5C66; color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fog); color: var(--ink); font: 400 16px/1.55 var(--font-body); -webkit-font-smoothing: antialiased; }
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.025em; line-height: 1.08; margin: 0; }
h1 { font-size: clamp(1.75rem, 3.2vw, 2.4rem); }
h2 { font-size: 1.3rem; letter-spacing: -.02em; }
h3 { font-size: 1.05rem; letter-spacing: -.01em; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--pine); outline-offset: 2px; border-radius: 2px; }
.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i-sm { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ——— Contrôles ——— */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: var(--r-ctl); background: var(--pine); color: var(--on-pine); font-weight: 700; text-decoration: none; cursor: pointer; transition: background .15s; white-space: nowrap; }
.btn:hover { background: var(--pine-deep); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface); }
.btn-quiet { background: transparent; color: var(--ink-2); padding: 0 10px; }
.btn-quiet:hover { background: var(--line); color: var(--ink); }
.btn-danger { background: var(--brick); color: #fff; }
.btn-danger:hover { background: var(--brick); filter: brightness(.92); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: .9rem; }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: var(--r-ctl); background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover, .icon-btn[aria-pressed="true"] { background: var(--line); color: var(--ink); }

.field { display: grid; gap: 6px; }
.field label, .label { font-size: .9rem; font-weight: 700; }
.field small { color: var(--ink-3); font-size: .85rem; }
.input, select.input, textarea.input { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-ctl); background: var(--surface); }
.input:focus { outline: 2px solid var(--pine); outline-offset: -1px; border-color: var(--pine); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--pine); flex: none; }

.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-ctl); font-size: .95rem; border-left: 3px solid; }
.flash-success { background: var(--pine-wash); border-color: var(--pine); }
.flash-error { background: var(--brick-wash); border-color: var(--brick); }
.flash-warn { background: var(--amber-wash); border-color: var(--amber); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--line); font-size: .82rem; font-weight: 700; color: var(--ink-2); }
.chip-pine { background: var(--pine-wash); color: var(--pine); }
.chip-amber { background: var(--amber-wash); color: #8A6414; }
.chip-brick { background: var(--brick-wash); color: var(--brick); }
:root[data-theme="dark"] .chip-amber { color: var(--amber); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.panel-pad { padding: 20px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.panel-head a { font-size: .9rem; color: var(--pine); font-weight: 700; text-decoration: none; }

/* ——— Ruban de stockage : barre segmentée par type ——— */
.ribbon { display: flex; height: 14px; border-radius: 3px; overflow: hidden; background: var(--line); gap: 2px; }
.ribbon span { display: block; min-width: 0; height: 100%; }
.ribbon .k-image { background: var(--k-image); }
.ribbon .k-video { background: var(--k-video); }
.ribbon .k-document { background: var(--k-document); }
.ribbon .k-other { background: var(--k-other); }
.ribbon .k-reserved { background: repeating-linear-gradient(-45deg, var(--amber) 0 4px, transparent 4px 8px); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .88rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* ——— La dalle signature ——— */
.slab { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 16px; width: 100%; padding: 24px 24px 22px; border: 0; border-radius: var(--r-slab); background: var(--pine); color: var(--on-pine); text-align: left; cursor: pointer; overflow: hidden; isolation: isolate; }
.slab::after { content: ""; position: absolute; inset: auto -30% -70% 35%; height: 180%; background: radial-gradient(closest-side, rgba(255,255,255,.14), transparent); z-index: -1; transition: transform .6s var(--ease); }
.slab:hover::after { transform: translateY(-8%); }
.slab-title { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.7rem, 5.4vw, 2.6rem); line-height: .98; letter-spacing: -.035em; font-stretch: 85%; }
.slab-sub { margin-top: 10px; font-size: .95rem; opacity: .82; max-width: 34ch; }
.slab-go { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--on-pine); color: var(--pine); }
.slab-go .i { width: 26px; height: 26px; stroke-width: 2; }

/* ——— Feuille de sauvegarde (bottom sheet / dialog) ——— */
dialog.sheet { width: min(560px, 100%); max-height: 92dvh; margin: auto auto 0; padding: 0; border: 0; border-radius: var(--r-slab) var(--r-slab) 0 0; background: var(--paper); color: var(--ink); }
dialog.sheet::backdrop { background: rgba(16, 25, 30, .5); }
dialog.sheet[open] { animation: sheet-in .32s var(--ease); }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 720px) { dialog.sheet { margin: auto; border-radius: var(--r-slab); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 4px; }
.sheet-body { padding: 12px 20px 24px; }
.sources { display: grid; gap: 8px; }
.source { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); cursor: pointer; text-align: left; width: 100%; }
.source:hover { border-color: var(--pine); }
.source[hidden] { display: none; }
.source-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-ctl); background: var(--pine-wash); color: var(--pine); }
.source b { display: block; font-size: 1rem; }
.source small { color: var(--ink-3); font-size: .85rem; }

/* ——— Coque de l'application ——— */
.shell { min-height: 100dvh; }
.side { display: none; }
.main { padding: 16px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); max-width: 1180px; margin: 0 auto; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; min-height: 44px; }
.topbar h1 { flex: 1; font-size: 1.6rem; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; letter-spacing: -.03em; text-decoration: none; color: var(--ink); }
.brand svg { width: 30px; height: 30px; color: var(--pine); }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.tabbar a, .tabbar button { display: grid; justify-items: center; gap: 3px; padding: 10px 0 9px; border: 0; background: none; color: var(--ink-3); font-size: .72rem; font-weight: 700; text-decoration: none; cursor: pointer; }
.tabbar [aria-current="page"] { color: var(--pine); }
.tabbar .tab-add { position: relative; top: -12px; justify-self: center; width: 58px; height: 58px; padding: 0; place-items: center; border-radius: 18px; background: var(--pine); color: var(--on-pine); box-shadow: 0 6px 16px -6px rgba(31, 66, 57, .55); }
.tabbar .tab-add .i { width: 26px; height: 26px; stroke-width: 2.1; }

@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: var(--side-w) 1fr; }
  .side { position: sticky; top: 0; display: flex; flex-direction: column; gap: 4px; height: 100dvh; padding: 22px 14px; border-right: 1px solid var(--line); background: var(--paper); }
  .side .brand { padding: 0 10px 18px; }
  .side-link { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 10px; border-radius: var(--r-ctl); color: var(--ink-2); text-decoration: none; font-weight: 700; font-size: .95rem; }
  .side-link:hover { background: var(--line); color: var(--ink); }
  .side-link[aria-current="page"] { background: var(--pine-wash); color: var(--pine); }
  .side-gap { height: 14px; }
  .side-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); }
  .side-foot .ribbon { height: 6px; margin: 8px 0 6px; }
  .side .btn { margin: 0 0 14px; }
  .main { padding: 28px 40px 60px; width: 100%; }
  .tabbar { display: none; }
}

/* ——— Tableau de bord ——— */
.dash { display: grid; gap: 18px; }
.storage-card { display: grid; gap: 14px; padding: 20px; }
.storage-figure { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.storage-figure strong { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.dash-cols { display: grid; gap: 18px; }
@media (min-width: 960px) { .dash-cols { grid-template-columns: 1.5fr 1fr; align-items: start; } }

.rows { list-style: none; margin: 0; padding: 6px 0; }
.row { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 10px 20px; text-decoration: none; }
.row + .row { border-top: 1px solid var(--line); }
.row-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { font-size: .85rem; color: var(--ink-3); }
.thumb { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-ctl); background: var(--fog); color: var(--ink-2); overflow: hidden; }
.thumb.k-image { background: var(--pine-wash); color: var(--pine); }
.thumb.k-video { background: color-mix(in srgb, var(--k-video) 22%, var(--surface)); color: var(--k-video); }
.thumb.k-pdf, .thumb.k-document { background: color-mix(in srgb, var(--k-document) 26%, var(--surface)); color: var(--ink-2); }

.empty { display: grid; justify-items: start; gap: 10px; padding: 26px 20px 24px; }
.empty p { color: var(--ink-2); max-width: 40ch; }

.transfer { padding: 14px 20px; display: grid; gap: 8px; }
.transfer + .transfer { border-top: 1px solid var(--line); }
.transfer-open { cursor: pointer; border-radius: 12px; transition: background .15s; }
.transfer-open:hover, .transfer-open:focus-visible { background: var(--hover, rgba(47,93,80,.08)); outline: none; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--pine); border-radius: 3px; transition: width .3s; }
.bar.paused > span { background: var(--amber); }

/* ——— Gestionnaire de fichiers ——— */
.fm-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.search { position: relative; flex: 1 1 220px; }
.search .i-sm { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search .input { padding-left: 38px; min-height: 42px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-ctl); overflow: hidden; }
.seg button { border: 0; border-radius: 0; width: 40px; height: 40px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: -6px 0 14px; font-size: .92rem; color: var(--ink-3); }
.crumbs a { color: var(--ink-2); text-decoration: none; padding: 2px 4px; border-radius: 3px; }
.crumbs a:hover { background: var(--line); }

.items { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.item { position: relative; display: grid; grid-template-rows: auto auto; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); text-decoration: none; cursor: default; user-select: none; }
.item:hover { border-color: var(--line-2); }
.item[aria-selected="true"] { border-color: var(--pine); box-shadow: inset 0 0 0 1px var(--pine); }
.item-art { display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: calc(var(--r-panel) - 1px) calc(var(--r-panel) - 1px) 0 0; background: var(--fog); color: var(--ink-3); overflow: hidden; }
.item-art .i { width: 34px; height: 34px; stroke-width: 1.3; }
.item-art img { width: 100%; height: 100%; object-fit: cover; }
.item.is-folder .item-art { color: var(--pine); background: var(--pine-wash); }
.item-info { padding: 9px 11px 11px; min-width: 0; }
.item-name { font-weight: 700; font-size: .93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { font-size: .8rem; color: var(--ink-3); }
.item-fav { position: absolute; top: 8px; right: 8px; color: var(--amber); }
.item-fav .i-sm { fill: var(--amber); stroke: var(--amber); }
.item-sel { position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-2); background: var(--surface); display: none; place-items: center; }
.selecting .item-sel, .item:hover .item-sel { display: grid; }
.item[aria-selected="true"] .item-sel { display: grid; background: var(--pine); border-color: var(--pine); color: var(--on-pine); }

.items.as-list { grid-template-columns: 1fr; gap: 0; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); }
.as-list .item { grid-template-columns: 40px 1fr auto; grid-template-rows: none; align-items: center; gap: 12px; padding: 8px 14px; border: 0; border-radius: 0; background: none; }
.as-list .item + .item { border-top: 1px solid var(--line); }
.as-list .item-art { width: 40px; height: 40px; aspect-ratio: auto; border-radius: var(--r-ctl); }
.as-list .item-art .i { width: 22px; height: 22px; }
.as-list .item-info { padding: 0; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.as-list .item-fav { position: static; }
.as-list .item-sel { top: 17px; left: -4px; }

.dropzone { position: fixed; inset: 0; z-index: 50; display: none; place-items: center; background: color-mix(in srgb, var(--pine) 88%, transparent); color: var(--on-pine); }
.dropzone.on { display: grid; }
.dropzone p { font-family: var(--font-display); font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 800; letter-spacing: -.03em; }

.selbar { position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); z-index: 25; display: none; align-items: center; gap: 6px; padding: 8px 8px 8px 16px; border-radius: var(--r-panel); background: var(--ink); color: var(--fog); }
.selbar.on { display: flex; }
.selbar .icon-btn { color: var(--fog); }
.selbar .icon-btn:hover { background: rgba(255,255,255,.12); }
.selbar span { flex: 1; font-weight: 700; }
@media (min-width: 960px) { .selbar { left: calc(var(--side-w) + 40px); right: 40px; bottom: 20px; max-width: 640px; } }

.menu { position: fixed; z-index: 60; min-width: 200px; padding: 6px; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); box-shadow: 0 12px 32px -12px rgba(16, 25, 30, .35); }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: var(--r-ctl); background: none; text-align: left; cursor: pointer; }
.menu button:hover { background: var(--fog); }
.menu .danger { color: var(--brick); }

.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); z-index: 70; transform: translateX(-50%); padding: 10px 16px; border-radius: var(--r-ctl); background: var(--ink); color: var(--fog); font-weight: 700; font-size: .92rem; }
@media (min-width: 960px) { .toast { bottom: 24px; } }

.skeleton { background: linear-gradient(90deg, var(--line) 0 40%, var(--fog) 50%, var(--line) 60%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--r-panel); min-height: 150px; }
@keyframes shimmer { to { background-position: -150% 0; } }

/* ——— Pages simples (paramètres, stockage, abonnement) ——— */
.stack { display: grid; gap: 18px; }
.form-grid { display: grid; gap: 14px; }
@media (min-width: 720px) { .form-grid.two { grid-template-columns: 1fr 1fr; } }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; font-size: .95rem; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-weight: 700; text-align: right; }
.danger-zone { border-color: color-mix(in srgb, var(--brick) 40%, var(--line)); }

.plans { display: grid; gap: 12px; }
@media (min-width: 720px) { .plans { grid-template-columns: repeat(3, 1fr); } }
.plan { display: grid; align-content: start; gap: 10px; padding: 18px; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); }
.plan.current { border-color: var(--pine); box-shadow: inset 0 0 0 1px var(--pine); }
.plan-size { font-family: var(--font-display); font-weight: 800; font-size: 2.2rem; letter-spacing: -.04em; line-height: 1; }
.plan-price { font-weight: 700; }
.plan-price small { color: var(--ink-3); font-weight: 400; }

.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .93rem; }
.t th { text-align: left; font-weight: 700; color: var(--ink-3); font-size: .82rem; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t td.r, .t th.r { text-align: right; }
.t a { font-weight: 700; text-decoration: none; }
.t a:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ——— Administration : même système, posture plus dense ——— */
.adm .side { background: var(--ink); border-color: var(--ink); color: var(--fog); }
.adm .side .brand { color: var(--fog); }
.adm .side .brand svg { color: var(--lichen); --on-pine: var(--ink); }
.adm .side-link { color: #A9B7BD; }
.adm .side-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.adm .side-link[aria-current="page"] { background: rgba(201, 216, 197, .14); color: var(--lichen); }
.adm .side-foot { border-color: rgba(255,255,255,.1); }
.adm-badge { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--amber); color: var(--ink); font-size: .75rem; line-height: 20px; text-align: center; }
.adm-tabs { display: flex; gap: 4px; overflow-x: auto; margin: -4px -16px 16px; padding: 0 16px 6px; scrollbar-width: none; }
.adm-tabs a { flex: none; padding: 8px 12px; border-radius: var(--r-ctl); text-decoration: none; font-weight: 700; font-size: .9rem; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); }
.adm-tabs a[aria-current="page"] { background: var(--ink); color: var(--fog); border-color: var(--ink); }
@media (min-width: 960px) { .adm-tabs { display: none; } }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); overflow: hidden; }
.metric { padding: 16px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
.metric dt { font-size: .85rem; color: var(--ink-3); font-weight: 700; }
.metric dd { margin: 6px 0 0; font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.metric small { display: block; margin-top: 2px; font-size: .82rem; color: var(--ink-3); }
.metric .neg { color: var(--brick); }

.goal { display: grid; gap: 10px; padding: 20px; }
.goal-bar { position: relative; height: 26px; border-radius: 4px; background: var(--fog); overflow: hidden; }
.goal-bar span { display: block; height: 100%; background: var(--pine); }
.goal-bar.short span { background: var(--amber); }
.goal-bar i { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); }

.spark { display: flex; align-items: flex-end; gap: 3px; height: 72px; padding: 0 20px 18px; }
.spark span { flex: 1; min-height: 2px; background: var(--pine); opacity: .85; border-radius: 1px 1px 0 0; }

.adm-grid { display: grid; gap: 18px; }
@media (min-width: 1100px) { .adm-grid { grid-template-columns: 1.4fr 1fr; align-items: start; } }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters .input { min-height: 42px; width: auto; }
.filters .search { flex: 1 1 260px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); font-size: .9rem; }
.mini-bar { width: 90px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 8px; }
.mini-bar span { display: block; height: 100%; background: var(--pine); }
.plan-edit { display: grid; gap: 12px; padding: 18px 20px; }
.plan-edit + .plan-edit { border-top: 1px solid var(--line); }
.plan-edit .form-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); align-items: end; }
.warn-line { font-size: .86rem; color: var(--brick); }
.sev { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 8px; background: var(--ink-3); }
.sev-warning { background: var(--amber); } .sev-critical { background: var(--brick); }
.code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .85rem; background: var(--fog); padding: 2px 6px; border-radius: 3px; word-break: break-all; }

/* ——— Visionneuse ——— */
dialog.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #0D1418; color: #E3EAEC; display: none; }
dialog.viewer[open] { display: grid; grid-template-rows: auto 1fr; }
dialog.viewer::backdrop { background: #0D1418; }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: max(10px, env(safe-area-inset-top)) 12px 10px 18px; }
.viewer-bar .icon-btn { color: #C9D3D7; }
.viewer-bar .icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.viewer-name { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-meta { display: block; font-size: .85rem; color: #8FA0A7; }
.viewer-stage { display: grid; place-items: center; min-height: 0; padding: 0 12px max(12px, env(safe-area-inset-bottom)); }
.viewer-stage img, .viewer-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-stage iframe { width: min(1000px, 100%); height: 100%; border: 0; background: #fff; border-radius: 4px; }
.viewer-none { display: grid; justify-items: center; gap: 14px; text-align: center; color: #A9B7BD; }
.viewer-none .i { width: 56px; height: 56px; stroke-width: 1.2; }

/* ——— Recherche : ce qui a été compris ——— */
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 14px; font-size: .9rem; }

/* ——— Sélecteur de dossier ——— */
.pick-list { display: grid; max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); }
.pick { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; font-weight: 700; }
.pick:last-child { border-bottom: 0; }
.pick:hover { background: var(--fog); }
.pick[aria-selected="true"] { background: var(--pine-wash); color: var(--pine); }
.plan.wanted { border-color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber); }
.totp-setup { display: grid; gap: 18px; }
@media (min-width: 720px) { .totp-setup { grid-template-columns: 200px 1fr; } }
.qr { width: 200px; aspect-ratio: 1; padding: 6px; border-radius: var(--r-ctl); background: #fff; }
.qr svg { width: 100%; height: 100%; }
.recovery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 20px; margin: 0; padding-left: 22px; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.bell { position: relative; }
.bell-dot { position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--brick); color: #fff; font-size: .68rem; font-weight: 700; line-height: 17px; text-align: center; }
.sev { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin: 7px 8px 0 0; background: var(--ink-3); align-self: start; }
.sev-warning { background: var(--amber); } .sev-critical { background: var(--brick); }

/* ——— Miniatures et vue Photos chronologique ——— */
.item-art { position: relative; }
.item-play { position: absolute; right: 8px; bottom: 8px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: rgba(13, 20, 24, .6); color: #fff; }
.item-play .i-sm { fill: #fff; stroke: none; }
.items .month { grid-column: 1 / -1; margin: 18px 0 2px; font-size: 1.05rem; text-transform: none; }
.items .month:first-child { margin-top: 0; }
.items.photo-grid:not(.as-list) { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 3px; }
.photo-grid:not(.as-list) .item { border: 0; border-radius: 0; background: none; }
.photo-grid:not(.as-list) .item-art { aspect-ratio: 1; border-radius: 0; }
.photo-grid:not(.as-list) .item-info { display: none; }
.photo-grid:not(.as-list) .item[aria-selected="true"] { box-shadow: none; outline: 3px solid var(--pine); outline-offset: -3px; }
@media (max-width: 520px) { .items.photo-grid:not(.as-list) { grid-template-columns: repeat(3, 1fr); gap: 2px; } }

/* ——— Import depuis un lien ——— */
.imp-modes { display: grid; gap: 6px; }
.imp-mode { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface); cursor: pointer; }
.imp-mode:has(input:checked) { border-color: var(--pine); box-shadow: inset 0 0 0 1px var(--pine); }
.imp-mode input { margin: 3px 0 0; accent-color: var(--pine); width: 16px; height: 16px; }
.imp-mode b { display: block; font-size: .95rem; }
.imp-mode small { color: var(--ink-3); font-size: .84rem; }
.import-dock { position: fixed; right: 12px; left: 12px; bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); z-index: 29; max-height: 45vh; overflow: auto; box-shadow: 0 16px 40px -16px rgba(16, 25, 30, .45); }
@media (min-width: 960px) { .import-dock { left: auto; width: 400px; bottom: 20px; } }
.bar > span.indeterminate { width: 35% !important; animation: indet 1.3s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(290%); } }

/* ——— GitHub ——— */
.gh-me { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; font-size: .95rem; }
.gh-me img { border-radius: 50%; border: 1px solid var(--line); }
.gh-hero { display: grid; grid-template-columns: auto 1fr; gap: 22px; padding: 28px; align-items: start; max-width: 760px; }
.gh-hero h2 { margin: 0 0 8px; }
.gh-hero-mark { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: var(--pine-wash); color: var(--pine); }
.gh-hero-mark .i { width: 32px; height: 32px; }
.gh-points { list-style: none; padding: 0; margin: 16px 0 22px; display: grid; gap: 9px; color: var(--ink-2); }
.gh-points li { display: flex; gap: 10px; align-items: center; }
.gh-points .i-sm { color: var(--pine); flex: none; }
.gh { display: grid; grid-template-columns: minmax(240px, 300px) 1fr; gap: 18px; align-items: start; }
.gh-repos { position: sticky; top: 18px; max-height: calc(100dvh - 120px); display: flex; flex-direction: column; overflow: hidden; }
.gh-filter { flex: none; margin: 12px 14px 4px; }
.gh-repo-list { overflow-y: auto; flex: 1; padding: 4px 6px 8px; }
.gh-repo { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--r-ctl); background: none; color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
.gh-repo .row-meta { grid-column: 1 / -1; }
.gh-repo:hover { background: var(--fog); }
.gh-repo.on { background: var(--pine-wash); }
.gh-repo.on .row-title { color: var(--pine); }
.gh-more { margin: 0 14px 12px; }
.gh-browser { min-width: 0; }
.gh-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px 20px 6px; }
.gh-title { flex: 1; min-width: 160px; display: flex; align-items: center; gap: 8px; font-size: 1.08rem; overflow: hidden; }
.gh-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gh-branch { width: auto; min-height: 38px; max-width: 200px; padding: 6px 10px; }
.gh-back { display: none; }
.gh-crumbs { margin: 4px 20px 10px; }
.gh-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 0 20px 12px; border-bottom: 1px solid var(--line); }
.gh-tools-gap { flex: 1; }
.gh-row { grid-template-columns: 26px 1fr auto; padding: 4px 14px 4px 20px; }
.gh-row.sel { background: var(--pine-wash); }
.gh-check { display: grid; place-items: center; cursor: pointer; }
.gh-check input { width: 17px; height: 17px; accent-color: var(--pine); }
.gh-name { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 6px 0; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.gh-name:hover .row-title { color: var(--pine); text-decoration: underline; }
.gh-name .thumb { width: 34px; height: 34px; flex: none; }
.gh-actions { display: flex; align-items: center; gap: 2px; }
.gh-actions .row-meta { margin-right: 6px; white-space: nowrap; }
.gh-note { padding: 10px 20px 16px; margin: 0; font-size: .85rem; border-top: 1px solid var(--line); }
@media (max-width: 860px) {
  .gh { grid-template-columns: 1fr; }
  .gh-repos { position: static; max-height: none; }
  .gh-browser { display: none; }
  .gh.gh-open .gh-repos { display: none; }
  .gh.gh-open .gh-browser { display: block; }
  .gh-back { display: inline-grid; }
  .gh-hero { grid-template-columns: 1fr; padding: 22px; }
  .gh-tools-gap { display: none; }
}
[hidden] { display: none !important; }
.app-version { font-size: .78rem; color: var(--ink-3); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.side .app-version { padding: 6px 12px 0; }

/* ——— Volet des envois et imports (façon Drive) ——— */
.xfer-dock { position: fixed; left: 10px; right: 10px; bottom: calc(var(--nav-h) + 10px + env(safe-area-inset-bottom)); z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 18px 44px -14px rgba(16, 25, 30, .45); overflow: hidden; animation: sheet-in .3s var(--ease); }
@media (min-width: 960px) { .xfer-dock { left: auto; right: 20px; bottom: 20px; width: 400px; } }
body:has(#upload-dock) #import-dock { bottom: calc(var(--nav-h) + 100px + env(safe-area-inset-bottom)); }
@media (min-width: 960px) { body:has(#upload-dock) #import-dock { bottom: 110px; } }
.xfer-headrow { display: flex; align-items: center; gap: 4px; padding: 6px 10px 6px 2px; }
.xfer-head { flex: 1; display: flex; align-items: center; gap: 14px; min-width: 0; padding: 10px 10px 10px 14px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.xfer-ico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; flex: none; background: var(--pine-wash); color: var(--pine); transition: background .2s, color .2s; }
.xfer-dock.done .xfer-ico { background: var(--pine); color: var(--on-pine); }
.xfer-dock.err .xfer-ico { background: var(--brick-wash); color: var(--brick); }
.xfer-txt { display: grid; gap: 2px; min-width: 0; }
.xfer-txt b { font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xfer-txt span { font-size: .88rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.xfer-round { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: var(--fog); color: var(--ink); cursor: pointer; }
.xfer-round:hover { background: var(--line); }
.xfer-chev { transform: rotate(-90deg); transition: transform .25s var(--ease); }
.xfer-dock.open .xfer-chev { transform: rotate(90deg); }
.xfer-bar { height: 4px; background: var(--line); overflow: hidden; }
.xfer-bar > span { display: block; height: 100%; width: 0; background: var(--pine); transition: width .4s var(--ease); }
.xfer-bar > span.indeterminate { width: 35%; animation: indet 1.3s ease-in-out infinite; }
.xfer-dock.err .xfer-bar > span { background: var(--brick); }
.xfer-list { max-height: 0; overflow: auto; transition: max-height .3s var(--ease); }
.xfer-dock.open .xfer-list { max-height: 46vh; }
.xfer-list .transfer:first-child { border-top: 1px solid var(--line); }
.transfer-done .bar > span { background: var(--pine); }

/* Accueil sur téléphone : on va droit à l'essentiel (le bouton + de la barre du bas sert à sauvegarder) */
@media (max-width: 719px) {
  .page-home .flash-success, .page-home .home-hello h1, .page-home .slab { display: none; }
  .page-home .home-hello { justify-content: flex-end; margin-bottom: 6px; }
}

/* Abonnement : sélecteur Mensuel / Annuel lisible, cartes entièrement cliquables */
.seg.seg-text button { width: auto; height: 40px; padding: 0 14px; white-space: nowrap; font-size: .92rem; transition: none; }
.seg.seg-text button[aria-pressed="true"] { background: var(--pine); color: var(--on-pine); }
.seg-save { font-size: .78rem; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--amber-wash); color: #8A6414; margin-left: 4px; }
.seg.seg-text button[aria-pressed="true"] .seg-save { background: rgba(255,255,255,.2); color: inherit; }
.plan-pick { cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.plan-pick:hover, .plan-pick:focus-visible { border-color: var(--pine); box-shadow: 0 10px 26px -18px rgba(23, 37, 46, .55); outline: none; }
.plan-pick:active { transform: scale(.99); }
.plan-now { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plan-pick.selected { border-color: var(--pine); box-shadow: inset 0 0 0 2px var(--pine), 0 14px 30px -20px rgba(23, 37, 46, .6); }
.plan-pick.selected::after { content: "Touchez encore pour payer"; font-size: .82rem; color: var(--pine); font-weight: 700; }
.plan-save { font-size: .88rem; font-weight: 700; color: #2E7D4F; }
/* Forfait actuel : toujours en vert, peu importe la couleur d'accent du site */
.plan.current { border-color: #2E8B57; box-shadow: inset 0 0 0 1px #2E8B57; background: color-mix(in srgb, #2E8B57 5%, var(--surface)); }
.plan.current .chip { background: #DDF1E4; color: #1D6B40; }
.plan.current .chip::before { content: "✓"; }
:root[data-theme="dark"] .plan.current .chip { background: #1F3B2B; color: #8FD3A8; }

/* ——— Éditeur de documents ——— */
.page-editor { background: var(--fog); }
.page-editor > .flash { margin: 10px 14px 0; }
.ed { display: flex; flex-direction: column; height: 100dvh; }
.ed-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 3; }
.ed-title { flex: 1; min-width: 0; display: grid; }
.ed-title b { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-status { font-size: .8rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed.is-dirty .ed-status { color: #8A6414; font-weight: 700; }
.ed-actions { display: flex; align-items: center; gap: 2px; }
.ed-actions .icon-btn { position: relative; }
.ed-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--pine); color: var(--on-pine); font-size: .66rem; font-weight: 700; line-height: 16px; text-align: center; }
.ed-actions .btn { margin-left: 6px; }
.ed-tools { display: flex; align-items: center; gap: 4px; padding: 6px 10px; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; position: relative; z-index: 2; }
.ed-tool { flex: none; display: inline-flex; align-items: center; gap: 6px; min-width: 36px; height: 34px; padding: 0 9px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.ed-tool:hover { background: var(--fog); }
.ed-tool.on { background: var(--pine-wash); border-color: var(--pine); color: var(--pine); }
.ed-tool-main { background: var(--pine); color: var(--on-pine); font-weight: 700; }
.ed-tool-main:hover { background: var(--pine); filter: brightness(1.1); }
.ed-tool-quiet { color: var(--ink-3); font-size: .84rem; }
.ed-toolselect { height: 34px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--ink); padding: 0 6px; font: inherit; font-size: .9rem; }
.ed-tools-gap { flex: 1; min-width: 8px; }
.ed-count { flex: none; font-size: .8rem; color: var(--ink-3); white-space: nowrap; padding: 0 4px; }
.ed-flatten { flex: none; font-size: .84rem; white-space: nowrap; align-items: center; }
.ed-note { padding: 8px 14px; font-size: .86rem; background: var(--pine-wash); color: var(--ink); border-bottom: 1px solid var(--line); }
.ed-note-warn { background: var(--amber-wash); }
.ed-stage { flex: 1; min-height: 0; overflow: auto; position: relative; }
.ed-loading, .ed-error { display: grid; place-items: center; align-content: center; gap: 14px; min-height: 60%; padding: 30px; text-align: center; color: var(--ink-2); }
.ed-spin { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--pine); border-radius: 50%; animation: edspin .8s linear infinite; }
@keyframes edspin { to { transform: rotate(360deg); } }
@media (max-width: 640px) { .ed-actions .icon-btn { width: 38px; height: 38px; } .ed-bar { gap: 6px; padding: 6px 8px; } }

/* Texte */
.ed-textwrap { height: 100%; display: flex; }
.ed-text { flex: 1; width: 100%; height: 100%; min-height: 100%; resize: none; border: 0; outline: none; padding: 18px clamp(14px, 4vw, 48px); background: var(--surface); color: var(--ink); font: 15px/1.6 "Atkinson Hyperlegible", system-ui, sans-serif; tab-size: 4; }
.ed-text.is-code { font-family: ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace; font-size: 14px; line-height: 1.55; white-space: pre; }
.ed-mdpreview { flex: 1; overflow: auto; padding: 22px clamp(16px, 5vw, 64px); background: var(--surface); max-width: 860px; margin: 0 auto; line-height: 1.65; }
.ed-mdpreview pre { background: var(--fog); padding: 12px; border-radius: 8px; overflow: auto; }

/* Tableur */
.ed-tools-sheet { gap: 6px; }
.ed-namebox { flex: none; width: 70px; height: 34px; border: 1px solid var(--line-2); border-radius: 8px; text-align: center; font: 700 .9rem ui-monospace, monospace; background: var(--fog); color: var(--ink); }
.ed-fx { flex: none; font: italic 700 .95rem Georgia, serif; color: var(--ink-3); padding: 0 2px; }
.ed-formula { flex: 1; min-width: 160px; min-height: 34px !important; height: 34px; padding: 4px 10px !important; font-family: ui-monospace, Consolas, monospace !important; font-size: .9rem !important; }
.ed-sheetwrap { display: flex; flex-direction: column; height: 100%; }
.ed-gridscroll { flex: 1; overflow: auto; position: relative; background: var(--surface); outline: none; }
.ed-grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 13.5px; min-width: max-content; }
.ed-grid th { position: sticky; z-index: 1; background: var(--fog); color: var(--ink-3); font-weight: 700; font-size: .78rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); height: 26px; text-align: center; user-select: none; }
.ed-grid thead th { top: 0; }
.ed-grid tbody th { left: 0; z-index: 1; }
.ed-grid .ed-corner { left: 0; z-index: 2; }
.ed-grid td { height: 26px; padding: 0 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); cursor: cell; }
.ed-grid td.n { text-align: right; font-variant-numeric: tabular-nums; }
.ed-grid td.e { color: var(--brick); }
.ed-grid td.sel { outline: 2px solid var(--pine); outline-offset: -2px; background: var(--pine-wash); }
.ed-celledit { position: absolute; z-index: 4; border: 2px solid var(--pine); padding: 0 5px; font: 13.5px system-ui, sans-serif; background: var(--surface); color: var(--ink); outline: none; box-shadow: 0 6px 18px -8px rgba(0,0,0,.4); }
.ed-more { margin: 12px; }
.ed-tabs { flex: none; display: flex; gap: 2px; padding: 4px 8px; overflow-x: auto; background: var(--fog); border-top: 1px solid var(--line); }
.ed-tab { flex: none; padding: 6px 14px; border: 1px solid transparent; border-radius: 0 0 8px 8px; background: transparent; color: var(--ink-2); font: inherit; font-size: .86rem; cursor: pointer; }
.ed-tab.on { background: var(--surface); border-color: var(--line); border-top-color: var(--surface); color: var(--pine); font-weight: 700; }

/* Word */
.ed-docread { padding: 16px 8px 40px; }
.ed-docread .docx-wrapper { background: transparent !important; padding: 0 !important; }
.ed-docread .docx-wrapper > section.docx { box-shadow: 0 6px 24px -14px rgba(16,25,30,.45) !important; margin: 0 auto 18px !important; max-width: 100%; }
@media (max-width: 860px) { .ed-docread .docx-wrapper > section.docx { transform-origin: top left; zoom: .5; } }
.ed-docpage { max-width: 816px; min-height: calc(100% - 40px); margin: 18px auto 40px; padding: 72px clamp(18px, 8vw, 90px); background: #fff; color: #111; box-shadow: 0 6px 24px -14px rgba(16,25,30,.45); outline: none; font: 11pt/1.5 Calibri, Carlito, "Segoe UI", sans-serif; }
.ed-docpage h1 { font-size: 20pt; margin: .6em 0 .3em; color: #1f3864; font-weight: 600; }
.ed-docpage h2 { font-size: 15pt; margin: .6em 0 .3em; color: #2f5496; font-weight: 600; }
.ed-docpage h3 { font-size: 12.5pt; margin: .6em 0 .3em; color: #1f3763; font-weight: 600; }
.ed-docpage p { margin: 0 0 .6em; }
.ed-docpage table { border-collapse: collapse; width: 100%; margin: .4em 0 .8em; }
.ed-docpage td, .ed-docpage th { border: 1px solid #9aa3ab; padding: 4px 8px; vertical-align: top; min-width: 40px; }
.ed-docpage img { max-width: 100%; height: auto; }
.ed-docpage blockquote { margin: .4em 0 .8em; padding-left: 14px; border-left: 3px solid #c8ced3; color: #444; }
.ed-docpage a { color: #0563c1; }
@media (max-width: 640px) { .ed-docpage { margin: 0; min-height: 100%; box-shadow: none; padding: 22px 16px; } }

/* PDF */
.ed-pdfwrap { display: grid; justify-content: center; gap: 14px; padding: 14px 12px 60px; }
.ed-pdfwrap.placing .pdf-page { cursor: crosshair; }
.pdf-page { position: relative; background: #fff; box-shadow: 0 6px 22px -14px rgba(16,25,30,.5); }
.pdf-page.pending { background: #fff linear-gradient(90deg, #f3f5f6 25%, #e9edef 50%, #f3f5f6 75%) 0 0 / 200% 100%; animation: edpulse 1.2s infinite linear; }
@keyframes edpulse { to { background-position: -200% 0; } }
.pdf-page canvas { display: block; width: 100%; height: 100%; }
.pdf-overlay { position: absolute; inset: 0; }
.pdf-field { position: absolute; }
.pdf-field input, .pdf-field textarea, .pdf-field select { width: 100%; height: 100%; margin: 0; border: 1px solid rgba(29,78,216,.45); border-radius: 2px; background: rgba(219,234,254,.55); color: #0b1220; font: calc(var(--fh) * var(--s) * 1px) Helvetica, Arial, sans-serif; padding: 0 3px; resize: none; }
.pdf-field textarea { padding: 2px 3px; line-height: 1.2; }
.pdf-field input:focus, .pdf-field textarea:focus, .pdf-field select:focus { outline: 2px solid #1d4ed8; background: #fff; }
.pdf-field.is-check { display: grid; place-items: center; }
.pdf-field.is-check input { width: 90%; height: 90%; accent-color: #1d4ed8; }
.pdf-field input:disabled, .pdf-field textarea:disabled, .pdf-field select:disabled { background: transparent; border-color: transparent; }
.pdf-signhere { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; border: 2px dashed #d97706; background: rgba(254,243,199,.7); color: #92400e; font-weight: 700; font-size: calc(11px * var(--s)); border-radius: 4px; cursor: pointer; }
.pdf-el { position: absolute; border: 1px dashed transparent; touch-action: none; }
.pdf-el:hover, .pdf-el:focus-within { border-color: #1d4ed8; }
.pdf-el img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; display: block; }
.pdf-el-sig, .pdf-el-check { cursor: move; }
.pdf-eltext { width: 100%; height: 100%; outline: none; font: calc(var(--pt) * var(--s) * 1px) / 1.2 Helvetica, Arial, sans-serif; color: #0b1220; white-space: pre-wrap; overflow: visible; padding-left: 1px; min-width: 20px; }
.pdf-eltext:empty::before { content: "Votre texte"; color: #94a3b8; }
.pdf-checkmark { display: grid; place-items: center; width: 100%; height: 100%; font: 700 calc(100% * 1) sans-serif; color: #0b1220; font-size: calc(18px * var(--s)); }
.pdf-del, .pdf-grip, .pdf-sizes, .pdf-resize { position: absolute; opacity: 0; transition: opacity .15s; }
.pdf-el:hover > *, .pdf-el:focus-within > *, .pdf-el.active > * { opacity: 1; }
.pdf-el .pdf-eltext, .pdf-el img, .pdf-el .pdf-checkmark { opacity: 1; }
.pdf-del { top: -12px; right: -12px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: #b91c1c; color: #fff; font: 700 16px/24px sans-serif; cursor: pointer; z-index: 2; }
.pdf-grip { top: -2px; left: -20px; width: 18px; height: 22px; display: grid; place-items: center; background: #1d4ed8; color: #fff; border-radius: 4px; font-size: 12px; cursor: move; touch-action: none; }
.pdf-sizes { top: -30px; left: 0; display: flex; gap: 2px; }
.pdf-size { border: 0; background: #1d4ed8; color: #fff; border-radius: 4px; font: 700 11px/20px sans-serif; padding: 0 6px; cursor: pointer; }
.pdf-resize { right: -7px; bottom: -7px; width: 14px; height: 14px; border-radius: 50%; background: #1d4ed8; border: 2px solid #fff; cursor: nwse-resize; touch-action: none; }
@media (hover: none) { .pdf-del, .pdf-grip, .pdf-sizes, .pdf-resize { opacity: 1; } }
.sig-sheet .sheet-body { display: grid; gap: 12px; }
.sig-pad { width: 100%; height: auto; aspect-ratio: 3 / 1; border: 1px dashed var(--line-2); border-radius: 12px; background: #fff; touch-action: none; cursor: crosshair; }
.sig-hint { margin: 4px 0 0; font-size: .84rem; }
.sig-typed { margin-top: 10px; padding: 18px; border: 1px dashed var(--line-2); border-radius: 12px; background: #fff; color: #14213d; font: italic 2.2rem "Segoe Script", "Brush Script MT", "Snell Roundhand", "Apple Chancery", cursive; min-height: 80px; overflow: hidden; white-space: nowrap; }
.sig-saved { max-width: 100%; max-height: 120px; background: #fff; border-radius: 12px; padding: 8px; border: 1px solid var(--line); }
.sig-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sig-colors { display: flex; gap: 6px; }
.sig-color { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; background: #14213d; cursor: pointer; box-shadow: 0 0 0 1px var(--line-2); }
.sig-color.on { border-color: var(--surface); box-shadow: 0 0 0 2px var(--pine); }
.ed-versions .row { grid-template-columns: 40px 1fr auto; }
.ed-vbtns { display: flex; align-items: center; gap: 2px; }
.viewer-edit { margin-right: 6px; }
.ed-actions .btn:disabled { opacity: .45; cursor: default; }
.ed-note { display: flex; align-items: flex-start; gap: 8px; }
.ed-note > span { flex: 1; }
.ed-note-x { flex: none; width: 28px; height: 28px; margin: -4px -6px -4px 0; }
