/*
 * Atelier Gribouille — charte : ivoire, lin, encre, vert sapin ; Playfair Display et Montserrat.
 * Un carnet d'atelier à gauche, l'œuvre accrochée sur un mur de galerie à droite.
 */
:root {
  /* palette de la charte */
  --craie: #f8f5ef;
  --lin: #dccbb8;
  --blush: #d9a7a0;
  --argile: #c26f56;
  --olive: #6b6f4e;

  /* mur de galerie plus profond, carnet ivoire, accent vert sapin (plus d'orange) */
  --wall: #ddd3c4;
  --wall-2: #efe8dc;
  /* scène blanche : l'œuvre ressort sur un fond neutre, à peine ombré vers le bas */
  --stage: #ffffff;
  --stage-2: #f1eee8;
  --surface: #faf7f1;
  --surface-2: #f0e9dd;
  --ink: #2b2a22;
  --ink-2: #4e4c3e;
  --muted: #6c6556;
  --line: #ded3c2;
  --accent: #3e5a4c;
  --accent-soft: rgba(62, 90, 76, 0.12);
  --primary: #1c1b15;
  --on-primary: #f8f5ef;
  --on-ink: #f8f5ef;
  --texture: #6b6f4e;
  --danger: #a8402a;
  --danger-soft: #f6e3dc;
  --glass: rgba(248, 245, 239, 0.86);

  --f-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --f-body: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "Montserrat", "Helvetica Neue", Arial, sans-serif;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --wall: #1c1b15;
    --stage: #1c1b15;
    --stage-2: #15140f;
    --surface: #25241d;
    --surface-2: #2e2d25;
    --ink: #f3eee4;
    --ink-2: #ddd5c6;
    --muted: #a8a08f;
    --line: #3b392e;
    --accent: #9fbcab;
    --accent-soft: rgba(159, 188, 171, 0.16);
    --wall-2: #27261f;
    --primary: #f3eee4;
    --on-primary: #1c1b15;
    --on-ink: #1c1b15;
    --texture: #a3a77f;
    --danger: #f09a84;
    --danger-soft: #3b2620;
    --glass: rgba(37, 36, 29, 0.84);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --wall: #1c1b15;
  --stage: #1c1b15;
  --stage-2: #15140f;
  --surface: #25241d;
  --surface-2: #2e2d25;
  --ink: #f3eee4;
  --ink-2: #ddd5c6;
  --muted: #a8a08f;
  --line: #3b392e;
  --accent: #9fbcab;
  --accent-soft: rgba(159, 188, 171, 0.16);
  --wall-2: #27261f;
  --primary: #f3eee4;
  --on-primary: #1c1b15;
  --on-ink: #1c1b15;
  --texture: #a3a77f;
  --danger: #f09a84;
  --danger-soft: #3b2620;
  --glass: rgba(37, 36, 29, 0.84);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--wall);
  -webkit-font-smoothing: antialiased;
}

body {
  display: grid;
  grid-template-columns: 372px 1fr;
  grid-template-rows: 100%;
}

button, select, input { font: inherit; color: inherit; }

.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ico-lg { width: 26px; height: 26px; }

/* ---------- Carnet (panneau) ---------- */

.panel {
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .018) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .012) 0 1px, transparent 1px 3px),
    var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  height: 100%;
  padding: 28px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0; padding-bottom: 4px; }
.brand-mark {
  width: 56px; aspect-ratio: 1; margin-bottom: 8px;
  background: var(--ink);
  -webkit-mask: url(assets/logo-mark.svg) center / contain no-repeat;
  mask: url(assets/logo-mark.svg) center / contain no-repeat;
}
.brand-kicker {
  margin: 0;
  font-family: var(--f-body);
  font-weight: 400;
  font-size: 0.8rem;
  letter-spacing: 0.55em;
  padding-left: 0.55em;
  text-transform: uppercase;
  color: var(--ink);
}
.brand-name {
  margin: 2px 0 0;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 2.9rem;
  line-height: 1;
  letter-spacing: -0.005em;
}
.brand-tag {
  margin: 12px 0 0;
  font-size: 0.64rem;
  line-height: 1.8;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.lang-switch { display: inline-flex; margin-top: 12px; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.lang-switch button { appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.68rem; letter-spacing: 0.12em; padding: 4px 10px; cursor: pointer; line-height: 1.4; }
.lang-switch button:hover { color: var(--ink); }
.lang-switch button.on { background: var(--ink); color: var(--on-ink); cursor: default; }

.mobile-brand { display: none; }
.sheet-tabs { display: none; }

/* bannière « voir en français » */
.lang-offer { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 8px 40px 8px 16px; position: relative; grid-column: 1 / -1; background: var(--ink); color: var(--craie); font-size: 0.8rem; z-index: 5; }
.lang-offer .link { color: inherit; text-decoration: underline; font-weight: 600; }
.lang-offer-close { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 1.1rem; cursor: pointer; }
.lang-offer-close:hover { background: rgba(255, 255, 255, .15); }
body.has-lang-offer { grid-template-rows: auto minmax(0, 1fr); }

/* légende des rôles */
.roles-legend { list-style: none; margin: 0; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; border-radius: var(--r-sm); background: var(--surface-2); font-size: 0.78rem; color: var(--ink-2); line-height: 1.4; }
.roles-legend li { display: grid; grid-template-columns: 64px 1fr; gap: 8px; align-items: center; }
.roles-legend .tag { justify-self: start; }

/* bandeaux : tailles à vérifier, sélection partielle, compte avant export */
.alert { margin: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--accent-soft); border: 1px solid var(--accent); color: var(--ink); font-size: 0.82rem; line-height: 1.45; }
.alert .link, .partial .link { font-weight: 600; }
.account-note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px dashed var(--line); color: var(--ink-2); font-size: 0.8rem; }
.account-note .ico { margin-top: 2px; }
#export-free span small { display: block; font-size: 0.68rem; color: inherit; opacity: .75; }

/* ---------- Compte ---------- */
.account { display: flex; justify-content: center; margin-top: -14px; }
.acc-chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 0.8rem; cursor: pointer; max-width: 100%; }
.acc-chip:hover { border-color: var(--accent); color: var(--ink); }
.acc-chip.on { padding-left: 6px; }
.acc-chip .chev { width: 14px; height: 14px; color: var(--muted); }
.acc-chip[aria-expanded="true"] .chev { transform: rotate(180deg); }
.acc-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--on-primary); display: grid; place-items: center; font-weight: 600; font-size: 0.78rem; flex: none; background-size: cover; background-position: center; }
.acc-avatar.big { width: 52px; height: 52px; font-size: 1.3rem; }
.acc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* fenêtre de compte : carte centrée sur la scène, feuille en bas de l'écran sur téléphone */
.account-modal { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 20px; background: rgba(43, 42, 34, 0.42); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade .18s ease-out; }
.acc-card { position: relative; width: min(440px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 30px 28px 24px; border-radius: 22px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .55), 0 0 0 1px var(--line); display: flex; flex-direction: column; gap: 14px; animation: rise .22s ease-out; }
.acc-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--ink-2); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.acc-close:hover { background: var(--line); color: var(--ink); }
.acc-mark { width: 44px; margin: 0 auto -4px; }
.acc-title { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 1.6rem; line-height: 1.15; text-align: center; }
.acc-sub { margin: 4px 0 0; text-align: center; color: var(--muted); font-size: 0.86rem; }
#auth-box, #profile-box, #recover-form { display: flex; flex-direction: column; gap: 14px; }
.social { display: flex; flex-direction: column; gap: 8px; }
.social-btn { justify-content: center; background: #fff; border-color: var(--line); font-weight: 600; }
.social-btn:hover { border-color: var(--ink-2); background: #fff; }
.social-btn .ico { stroke: none; width: 20px; height: 20px; }
.or { display: flex; align-items: center; gap: 12px; margin: 0; color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: .18em; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-tabs { display: flex; border-bottom: 1px solid var(--line); }
.auth-tabs button { flex: 1; padding: 9px 4px 10px; border: 0; background: none; color: var(--muted); font-size: 0.86rem; font-weight: 500; cursor: pointer; position: relative; }
.auth-tabs button.on { color: var(--ink); font-weight: 600; }
.auth-tabs button.on::after { content: ""; position: absolute; left: 10%; right: 10%; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; }
#auth-form, #profile-form { display: flex; flex-direction: column; gap: 12px; }
.acc-card .field { font-size: 0.8rem; gap: 5px; }
.acc-card .field small { font-weight: 400; color: var(--muted); }
.acc-card input[type="text"], .acc-card input[type="email"], .acc-card input[type="password"] { width: 100%; box-sizing: border-box; padding: 11px 12px; border-radius: 11px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 0.95rem; transition: border-color .15s, box-shadow .15s; }
.acc-card input::placeholder { color: #b5ad9d; }
.acc-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pw { position: relative; display: block; }
.pw input { padding-right: 44px !important; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.pw-eye:hover { color: var(--ink); background: var(--surface-2); }
.pw-meter { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 2px; font-size: 0.74rem; font-weight: 400; color: var(--muted); }
.pw-bar { flex: 1 1 100%; height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.pw-bar i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--danger); transition: width .2s, background .2s; }
.pw-meter[data-score="1"] i { width: 25%; background: var(--danger); }
.pw-meter[data-score="2"] i { width: 50%; background: var(--argile); }
.pw-meter[data-score="3"] i { width: 75%; background: var(--olive); }
.pw-meter[data-score="4"] i { width: 100%; background: var(--accent); }
.pw-label { font-weight: 600; color: var(--ink-2); }
.pw-tips { flex: 1 1 100%; line-height: 1.4; }
.btn-wide { width: 100%; justify-content: center; margin-top: 4px; }
.acc-links { margin: 0; display: flex; justify-content: center; gap: 10px; font-size: 0.8rem; color: var(--muted); flex-wrap: wrap; }
.acc-links .link { color: var(--ink-2); text-decoration: none; }
.acc-links .link[hidden] + span { display: none; }
.acc-links .link:hover { color: var(--accent); text-decoration: underline; }
.acc-legal { margin: 0; text-align: center; font-size: 0.7rem; color: var(--muted); line-height: 1.5; }
.acc-legal a { color: var(--ink-2); }
.acc-head { display: flex; align-items: center; gap: 14px; }
.acc-head .acc-title, .acc-head .acc-sub { text-align: left; }
.acc-status { margin: 0; padding: 10px 12px; border-radius: 11px; background: var(--accent-soft); color: var(--ink-2); font-size: 0.82rem; line-height: 1.45; }
.acc-status.bad { background: var(--danger-soft); color: var(--danger); }
.danger-zone { margin-top: 4px; padding-top: 12px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 8px; }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger.confirm { background: var(--danger); color: var(--on-ink); border-color: var(--danger); }
.saved .saved-kind { display: inline-grid; place-items: center; width: 72px; height: 54px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: 0.62rem; letter-spacing: .12em; text-transform: uppercase; }
.saved .saved-dl { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 6px; border-radius: 999px; }
.saved .saved-dl:hover { background: var(--accent-soft); }
.saved .saved-actions { display: flex; align-items: center; gap: 2px; }
#exports-box { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--line); }
#exports-box h3 { margin: 0; }
.saved .saved-where { display: inline-flex; align-items: center; gap: 4px; font-size: 0.68rem; color: var(--accent); margin-left: 6px; vertical-align: middle; }
.saved .saved-where .ico { width: 13px; height: 13px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (max-width: 600px) {
  .account-modal { place-items: end center; padding: 0; }
  .acc-card { width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; padding: 26px 20px calc(22px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .social-btn, :root:not([data-theme="light"]) .acc-card input[type="text"], :root:not([data-theme="light"]) .acc-card input[type="email"], :root:not([data-theme="light"]) .acc-card input[type="password"] { background: var(--surface-2); }
}

/* pied du carnet : un filet, une boucle de crayon, une phrase en italique, trois mots en petites capitales */
.brand-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 28px; }
.foot-rule { display: flex; align-items: center; gap: 12px; width: 100%; color: var(--muted); }
.foot-rule span { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line) 30%, var(--line) 70%, transparent); }
.foot-curl { width: 52px; height: 20px; flex: none; opacity: .9; }
.foot-line { margin: 2px 0 0; font-family: var(--f-display); font-style: italic; font-size: 1.02rem; line-height: 1.3; color: var(--ink-2); text-align: center; }
.brand-values { margin: 0; text-align: center; font-size: 0.58rem; letter-spacing: .26em; text-transform: uppercase; color: var(--muted); line-height: 2; }
.brand-values i { font-style: normal; color: var(--accent); margin: 0 2px; }

.step { display: flex; flex-direction: column; gap: 12px; }
.step h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 1.34rem;
  text-wrap: balance;
}
.num { font-family: var(--f-body); font-size: 0.66rem; font-weight: 500; letter-spacing: 0.2em; color: var(--accent); }
/* sections repliables : un clic sur le titre replie ou développe la section */
.step h2 { cursor: pointer; user-select: none; border-radius: var(--r-sm); }
.step h2:hover { color: var(--accent); }
.step h2:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.step h2 .chev { margin-left: auto; width: 14px; height: 14px; flex: none; align-self: center; color: var(--muted); transition: transform .18s; }
.step.collapsed h2 .chev { transform: rotate(-90deg); }
.step.collapsed > :not(h2) { display: none !important; }
h3 { margin: 6px 0 0; font-size: 0.9rem; font-weight: 600; }
small { color: var(--muted); font-weight: 400; font-family: var(--f-body); font-size: 0.72rem; font-variant-numeric: tabular-nums; }

.hint { margin: 0; color: var(--muted); font-size: 0.84rem; line-height: 1.45; }
.hint.ai:empty { display: none; }
.hint.ai { padding: 10px 12px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--ink-2); }
.mono-note { font-family: var(--f-mono); font-size: 0.74rem; font-variant-numeric: tabular-nums; }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 26px 16px;
  border: 1.5px dashed var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.drop strong { font-weight: 600; }
.drop span { font-size: 0.82rem; color: var(--muted); }
.drop .ico { color: var(--accent); }
.drop.over, .drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }

.progress { position: relative; height: 30px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--accent-soft); border-right: 2px solid var(--accent); transition: width .25s; }
.progress span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-mono); font-size: 0.74rem; color: var(--ink-2); }

.save-status.bad { color: var(--danger); }
.fatal { position: fixed; z-index: 1000; left: 50%; top: 12px; transform: translateX(-50%); width: min(640px, calc(100vw - 32px)); padding: 14px 16px; border-radius: var(--r-md); background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18); font-size: 0.86rem; }
.fatal .fatal-text { margin: 0 0 10px; white-space: pre-wrap; word-break: break-word; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.row-btns .btn { flex: 1 1 140px; }
.fatal .row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.fatal .btn { padding: 6px 12px; font-size: 0.8rem; }
.notice { margin: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--danger-soft); color: var(--danger); font-size: 0.84rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  padding: 13px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s;
}
.btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); box-shadow: 0 6px 18px -10px rgba(0, 0, 0, .55); letter-spacing: .02em; }
.btn-primary:hover:not(:disabled) { background: var(--ink); border-color: var(--ink); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 22px -10px rgba(0, 0, 0, .5); }
.btn:disabled { opacity: .55; cursor: default; }
button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button.link { border: 0; padding: 0; background: none; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font-size: inherit; }

.guide-box { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; padding: 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.guide-title { margin: 0; font-family: var(--f-display); font-style: italic; font-size: 1.08rem; }
.guide-box .hint:empty { display: none; }

/* Propositions */
.proposals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.proposal {
  display: flex; flex-direction: column; align-items: stretch; gap: 4px;
  padding: 6px 6px 9px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  min-width: 0;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.proposal:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -14px rgba(0, 0, 0, .45); }
.proposal img { width: 100%; aspect-ratio: 10 / 7; object-fit: contain; background: var(--surface-2); border-radius: 7px; display: block; margin-bottom: 3px; }
.proposal b { font-size: 0.8rem; font-weight: 600; line-height: 1.2; padding-inline: 2px; }
.proposal small { font-family: var(--f-display); font-style: italic; font-size: 0.76rem; line-height: 1.25; color: var(--muted); padding-inline: 2px; overflow-wrap: anywhere; }
.proposal.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Réglages */
.settings { border-top: 1px solid var(--line); padding-top: 12px; }
.settings summary { cursor: pointer; font-weight: 600; font-size: 0.88rem; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.settings summary small { font-weight: 400; color: var(--muted); font-size: 0.74rem; margin-left: auto; text-align: right; }
.settings summary::after { content: "+"; font-family: var(--f-mono); color: var(--muted); }
.settings[open] summary::after { content: "−"; }
.settings summary::-webkit-details-marker { display: none; }
.settings[open] { display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.84rem; font-weight: 500; color: var(--ink-2); }
.field-head { display: flex; align-items: center; justify-content: space-between; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 0.88rem;
  font-weight: 400;
}
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=number] { padding: 8px 10px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface-2); }

.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 0.86rem; cursor: pointer; font-weight: 400; position: relative; }
.switch.row { display: flex; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; margin: 0; }
.switch.row { margin-top: 2px; }
.switch.off { opacity: .45; cursor: default; }
.switch small { color: var(--muted); font-size: 0.74rem; }
.switch span { position: relative; width: 34px; height: 20px; border-radius: 999px; background: var(--line); transition: background .2s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(14px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.aside-note { margin: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px dashed var(--line); font-size: 0.82rem; line-height: 1.45; color: var(--ink-2); }
.aside-note b { color: var(--ink); }

/* Tailles à vérifier */
.sizes-check { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--r-md); background: var(--accent-soft); border: 1px solid var(--line); }
.sizes-title { margin: 0; font-family: var(--f-display); font-style: italic; font-size: 1.02rem; }
.sizes-list { display: flex; flex-direction: column; gap: 6px; }
.sizes-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px; border-radius: var(--r-sm); background: var(--surface); }
.sizes-row img { width: 40px; height: 40px; object-fit: contain; background: var(--surface-2); border-radius: 6px; }
.sizes-name { font-size: 0.82rem; font-weight: 600; display: flex; flex-direction: column; }
.sizes-name small { font-weight: 400; }
.sizes-input { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.sizes-chips { display: inline-flex; gap: 3px; margin-right: 4px; }
.sizes-chips button { padding: 5px 7px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); font-size: 0.72rem; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.sizes-chips button:hover { border-color: var(--accent); color: var(--ink); }
.sizes-input input { width: 74px; padding: 7px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.sizes-input em { font-style: normal; font-size: 0.8rem; color: var(--muted); }
.thumb .size.unsure { background: var(--accent); color: var(--on-ink); }

/* Dessins et pièces */
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.grid.pieces { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }

.thumb {
  position: relative; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line);
  transition: transform .15s, box-shadow .2s;
}
.thumb:hover { transform: translateY(-1px); box-shadow: 0 6px 14px -10px rgba(0, 0, 0, .5); }
.pieces .thumb { background: var(--surface-2) repeating-conic-gradient(var(--line) 0 25%, transparent 0 50%) 0 0 / 10px 10px; }
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb.off img { opacity: .25; filter: grayscale(1); }
.thumb.unplaced { border-style: dashed; }
.thumb.unplaced img { opacity: .55; }
.thumb .tag { position: absolute; left: 4px; bottom: 4px; }
.thumb .size { position: absolute; right: 4px; top: 4px; font-style: normal; font-family: var(--f-mono); font-size: 0.6rem; background: var(--glass); color: var(--ink); padding: 1px 5px; border-radius: 4px; }
.thumb.current { outline: 2px solid var(--accent); outline-offset: 2px; }

.tag { display: inline-block; font-size: 0.64rem; font-weight: 600; padding: 1px 6px; border-radius: 999px; letter-spacing: .01em; }
.tag.cutout { background: var(--accent); color: var(--on-ink); }
.tag.photo { background: var(--ink); color: var(--on-ink); }
.thumb .tag.photo { left: 4px; bottom: 24px; }
.hint.photo { padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); }
.tag.texture { background: var(--texture); color: var(--on-ink); }
.tag.off { background: var(--muted); color: var(--on-ink); }

.detail {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 2;
  display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: 0 12px 24px -18px rgba(0, 0, 0, .5);
}
.detail .detail-close { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); font-size: 1.25rem; line-height: 1; cursor: pointer; }
.detail .detail-close:hover { background: var(--line); color: var(--ink); }
.detail .name { padding-right: 30px; }
.detail > img { width: 84px; height: 84px; object-fit: contain; background: var(--surface-2); border-radius: var(--r-sm); }
.detail > div { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.detail .name { margin: 0; font-weight: 600; font-size: 0.9rem; overflow-wrap: anywhere; }
.detail .name small { display: block; }
.detail .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.8rem; }
.detail .row select, .detail .row input { width: 52%; padding: 7px 8px; }
.seg { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--surface-2); }
.seg button { flex: 1; padding: 5px 4px; border: 0; border-radius: 999px; background: none; font-size: 0.74rem; cursor: pointer; color: var(--muted); }
.seg button.on { color: var(--on-ink); font-weight: 600; }
.seg button.on.cutout { background: var(--accent); }
.seg button.on.texture { background: var(--texture); }
.seg button.on.off { background: var(--muted); }
.seg button.on.ink { background: var(--ink); }
.field > .seg { margin-top: 4px; }
.field small#ground-name { color: var(--muted); font-size: 0.74rem; margin-left: 6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.swatches button { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; background: var(--sw); }
.swatches button.auto { background: var(--ink); color: var(--on-ink); font: 700 0.7rem var(--f-body); }
.swatches button.none { background: repeating-linear-gradient(45deg, #efe9dd 0 3px, #e3dccd 3px 6px); }
.swatches button.on { box-shadow: 0 0 0 2px var(--ink); }
.swatches.off { opacity: .35; pointer-events: none; }
.swatches button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Mur de galerie (scène) ---------- */

.stage {
  position: relative; height: 100%; overflow: hidden;
  background: linear-gradient(180deg, var(--stage, var(--wall)) 0%, var(--stage, var(--wall)) 55%, var(--stage-2, var(--wall-2)) 100%);
}
.stage canvas { position: absolute; inset: 64px 0 64px 0; width: 100%; height: calc(100% - 128px); touch-action: none; }

.toolbar {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 3;
  display: flex; gap: 2px; padding: 5px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .5);
  max-width: calc(100% - 32px);
  overflow-x: auto;
}
.toolbar button {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px;
  border: 0; border-radius: 999px; background: none;
  font-size: 0.82rem; font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background .15s, opacity .15s;
}
.toolbar button:hover:not(:disabled) { background: var(--accent-soft); }
.toolbar button[data-act="del"]:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }
.toolbar button:disabled { opacity: .35; cursor: default; }
.toolbar .tb-sep { width: 1px; align-self: stretch; margin: 6px 3px; background: var(--line); flex: none; }
.stage-tip { position: absolute; top: 66px; left: 0; right: 0; margin: 0; text-align: center; font-size: 0.74rem; color: var(--muted); pointer-events: none; z-index: 1; }

/* Zoom sur l'œuvre */
.zoom {
  position: absolute; right: 14px; bottom: 14px; z-index: 3;
  display: flex; align-items: center; gap: 2px; padding: 4px;
  border-radius: 999px; background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .5);
}
.zoom button {
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: 999px; background: none; font-size: 1.05rem; cursor: pointer;
}
.zoom button:hover { background: var(--accent-soft); }
.zoom button.mode { width: auto; padding: 0 10px; font-size: 0.74rem; font-weight: 600; letter-spacing: .02em; display: inline-flex; align-items: center; gap: 6px; margin: 0; box-sizing: border-box; flex: none; }
.zoom button.mode .ico { width: 16px; height: 16px; }
.zoom button.mode[aria-pressed="true"] { background: var(--ink); color: var(--craie); }
body.bg-mode .stage { outline: 2px dashed var(--olive); outline-offset: -2px; }
.zoom button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.zoom-val { min-width: 48px; text-align: center; font-family: var(--f-mono); font-size: 0.72rem; font-variant-numeric: tabular-nums; }
body.stage-full .stage { position: fixed; inset: 0; z-index: 40; height: auto; }
body.stage-full .stage { padding-top: env(safe-area-inset-top, 0px); }
body.stage-full .toolbar { top: calc(10px + env(safe-area-inset-top, 0px)); }
body.stage-full .stage canvas {
  inset: calc(60px + env(safe-area-inset-top, 0px)) 0 auto 0;
  height: calc(100% - 60px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}
body.stage-full .label, body.stage-full .stage-tip { display: none; }
body.stage-full { overflow: hidden; }

/* Cartel de musée */
.density-bar {
  position: absolute; left: 14px; bottom: 14px; z-index: 3;
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(8px);
  font-size: 0.8rem; font-weight: 600;
}
.density-bar input[type=range] { width: 130px; margin: 0; }
.density-bar small { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
body.stage-full .density-bar { display: none; }
.label {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  margin: 0; padding: 9px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: max-content;
  max-width: calc(100% - 720px); /* entre la barre de densité (à gauche) et le zoom (à droite) */
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 6px 16px -12px rgba(0, 0, 0, .5);
  text-align: center;
}
.label b { font-family: var(--f-display); font-style: italic; font-weight: 400; font-size: 1.02rem; }
.label span { font-family: var(--f-body); font-size: 0.6rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); font-variant-numeric: tabular-nums; }

.empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; pointer-events: none; }
.empty > div { max-width: 46ch; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.empty button { pointer-events: auto; margin-top: 6px; }
.empty-pictos { display: flex; align-items: flex-end; gap: 18px; }
.empty-pictos img { height: 46px; width: auto; }
.empty-title { margin: 0; font-family: var(--f-display); font-style: italic; font-size: clamp(1.7rem, 3.2vw, 2.5rem); line-height: 1.2; text-wrap: balance; }
.empty-rule { width: 40px; height: 1px; background: var(--ink-2); }

/* Bouton de retouche sur les vignettes de pièces */
.thumb .edit-piece {
  position: absolute; right: 3px; bottom: 3px;
  display: grid; place-items: center;
  width: 24px; height: 24px; padding: 0;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--glass); color: var(--ink); cursor: pointer;
  opacity: 0; transition: opacity .15s;
}
.thumb .edit-piece .ico { width: 14px; height: 14px; }
.thumb:hover .edit-piece, .thumb .edit-piece:focus-visible { opacity: 1; }
@media (hover: none) { .thumb .edit-piece { opacity: 1; } }

/* Écrans moyens (iPad, petit portable) : la scène est trop étroite pour loger densité, cartouche et zoom
   sur une même ligne ; le cartouche passe au-dessus des commandes. */
@media (min-width: 861px) and (max-width: 1400px) {
  .label { bottom: 72px; max-width: calc(100% - 28px); }
}

.save-status { margin: 0; padding: 8px 10px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--ink-2); font-size: 0.82rem; }

/* Aperçu de secours pour enregistrer l'image */
.preview { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--surface); padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.preview-bar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.preview-bar h2 { margin: 0 0 4px; font-family: var(--f-display); font-weight: 400; font-size: 1.3rem; }
.preview-bar .btn { width: auto; flex: none; }
.preview-stage { min-height: 0; overflow: auto; padding: 16px; display: grid; place-items: center; background: var(--wall); -webkit-touch-callout: default; }
.preview-stage img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 12px 30px -16px rgba(0, 0, 0, .6); -webkit-touch-callout: default; -webkit-user-select: auto; user-select: auto; }
.preview-name { margin: 0; padding: 10px 20px; border-top: 1px solid var(--line); }

/* ---------- Éditeur de découpe ---------- */
body.editing { overflow: hidden; }
.editor {
  position: fixed; inset: 0; z-index: 50;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--surface);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.room-canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: move; background: var(--wall); }
.drop.small { padding: 16px 12px; }
.ed-help { margin: 0; margin-right: auto; color: var(--muted); font-size: 0.78rem; }
.ed-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.ed-head { margin-right: auto; min-width: 0; }
.ed-kicker { margin: 0; font-family: var(--f-body); font-size: 0.62rem; letter-spacing: .26em; text-transform: uppercase; color: var(--muted); }
.ed-head h2 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 1.3rem; overflow-wrap: anywhere; }
.ed-tools { padding: 3px; }
.ed-tools button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; font-size: 0.82rem; color: var(--ink-2); }
.ed-tools button.on { background: var(--ink); color: var(--on-ink); font-weight: 600; }
.ed-size { display: inline-flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--ink-2); }
.ed-size input { width: 120px; }
.ed-group { display: inline-flex; align-items: center; gap: 4px; }
.ed-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-width: 34px; height: 34px; padding: 0 10px; justify-content: center;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: 0.82rem; cursor: pointer;
}
.ed-btn:hover:not(:disabled) { background: var(--accent-soft); }
.ed-btn:disabled { opacity: .4; cursor: default; }
.ed-zval { min-width: 52px; text-align: center; font-family: var(--f-mono); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.ed-stage { position: relative; min-height: 0; }
.ed-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.ed-legend {
  position: absolute; left: 16px; bottom: 12px; margin: 0; padding: 6px 10px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 0.74rem; color: var(--ink-2);
  background: var(--glass); border: 1px solid var(--line); border-radius: 999px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  pointer-events: none; max-width: calc(100% - 32px);
}
.sw { display: inline-block; width: 14px; height: 4px; border-radius: 2px; }
.sw-cut { background: #e5007d; }
.sw-faded { height: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.ed-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 20px; border-top: 1px solid var(--line); }
.ed-foot .btn { width: auto; }
.ed-help { margin-right: auto; }
.ed-msg { margin: 0; flex-basis: 100%; color: var(--danger); font-size: 0.84rem; }
.ed-msg:empty { display: none; }

@media (max-width: 860px) {
  .ed-bar { padding: 10px 16px; gap: 8px 10px; }
  .ed-head { flex-basis: 100%; }
  .ed-tools button span, .ed-group .ed-btn span, .ed-help { display: none; }
  .ed-size input { width: 90px; }
  .ed-foot { padding: 10px 16px; }
  .ed-foot .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media (max-width: 860px) {
  :root { --sheet: 42svh; --topbar: 50px; --tabs: 64px; }
  html, body { height: 100%; }
  body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: 100svh; overflow: hidden; overscroll-behavior: none; }
  body.has-lang-offer { grid-template-rows: auto auto 1fr; }
  .mobile-brand {
    order: 0; display: flex; align-items: center; justify-content: flex-start; gap: 10px; position: relative; min-height: var(--topbar); box-sizing: border-box;
    padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .mobile-brand .brand-mark { width: 30px; margin: 0; }
  .mobile-brand-name { font-family: var(--f-display); font-size: 1.25rem; line-height: 1; }
  .mobile-brand-name small { font-family: var(--f-body); font-size: 0.56rem; letter-spacing: .4em; text-transform: uppercase; color: var(--ink); margin-right: 4px; vertical-align: middle; }
  .mobile-lang { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); margin: 0; }
  .lang-offer { position: static; grid-column: auto; }
  .stage { order: 1; height: auto; min-height: 0; padding-bottom: var(--sheet); box-sizing: border-box; }
  /* le carnet devient un tiroir fixe en bas de l'écran : l'œuvre reste visible pendant qu'on règle */
  .panel {
    order: 2; position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; height: var(--sheet); box-sizing: border-box;
    border-right: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; padding: var(--tabs) 16px calc(24px + env(safe-area-inset-bottom, 0px)); gap: 22px;
    box-shadow: 0 -12px 30px -20px rgba(0, 0, 0, .5); overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch;
  }
  /* tiroir agrandi : la variable change pour tout le monde (tiroir, onglets, toile, densité) */
  body.sheet-tall { --sheet: 86svh; }
  .panel .brand { display: none; }
  /* la barre d'onglets est fixée au bord haut du tiroir (pas de « sticky », que Safari perd parfois) */
  .sheet-tabs {
    display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; left: 0; right: 0; bottom: calc(var(--sheet) - var(--tabs)); height: var(--tabs); z-index: 7; margin: 0; padding: 6px 6px 0; box-sizing: border-box;
    background: var(--surface); border-bottom: 1px solid var(--line); border-radius: 18px 18px 0 0;
  }
  .sheet-tabs::before { content: ""; position: absolute; top: 4px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--line); }
  .sheet-tabs button { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; padding: 10px 1px 6px; border: 0; background: none; color: var(--muted); font-size: clamp(0.48rem, 2.3vw, 0.58rem); font-weight: 600; letter-spacing: 0; cursor: pointer; border-radius: var(--r-sm); min-width: 0; }
  /* chaque libellé tient sur une ligne : la taille suit la largeur de l'écran, jamais de retour à la ligne */
  .sheet-tabs button span { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .sheet-tabs button .ico { width: 20px; height: 20px; }
  .sheet-tabs button.on { color: var(--ink); background: var(--accent-soft); }
  .sheet-tabs button:disabled { opacity: .4; cursor: default; }
  .panel.tabbed > .step, .panel.tabbed > .account, .panel.tabbed > .brand-foot { display: none; }
  .panel.tabbed > .step.tab-on { display: flex; }
  .panel.tabbed[data-tab="more"] > .account, .panel.tabbed[data-tab="more"] > .brand-foot { display: flex; }
  .panel.tabbed > .step.tab-on.collapsed > :not(h2) { display: revert !important; }
  .panel.tabbed > .step.tab-on h2 .chev { display: none; }
  .panel.tabbed > .step.tab-on h2 { cursor: default; }
  .account { margin-top: 0; }
  body.stage-full .panel { display: none; }
  /* sur téléphone : la barre d'outils seule en haut, le zoom en colonne compacte collée au bord
     droit, l'œuvre à gauche de cette colonne (pas de superposition) */
  .stage canvas { inset: 56px 46px calc(var(--sheet) + 44px) 0; width: calc(100% - 46px); height: calc(100% - 56px - var(--sheet) - 44px); }
  body.stage-full .stage { padding-bottom: 0; }
  .stage-tip { display: none; }
  .empty { bottom: var(--sheet); padding: 16px 56px 16px 16px; }
  .empty-pictos img { height: 36px; }
  .empty-title { font-size: 1.5rem; }
  .toolbar { top: 10px; }
  .toolbar button span { display: none; }
  .toolbar { gap: 0; padding: 4px; }
  .toolbar button { padding: 8px 9px; }
  .toolbar .tb-sep { margin: 6px 1px; }
  .zoom { right: 6px; bottom: auto; top: 62px; flex-direction: column; align-items: center; padding: 3px; gap: 1px; border-radius: 20px; overflow: hidden; }
  .zoom button { width: 32px; height: 32px; }
  .zoom-val { min-width: 0; font-size: 0.6rem; text-align: center; padding: 2px 0; }
  .label { bottom: calc(var(--sheet) + 8px); max-width: calc(100% - 20px); padding: 6px 12px; }
  .label b { font-size: 0.9rem; }
  .label span { display: none; }
  .label:has(> b[hidden]) { display: none; } /* sans titre, le cartel n'a rien à dire sur téléphone */
  .zoom button.mode { display: grid; place-items: center; width: 32px; min-width: 32px; max-width: 32px; height: 32px; padding: 0; margin: 0; gap: 0; border-radius: 999px; }
  .zoom button.mode span { display: none; }
  .zoom button.mode .ico { display: block; }
  .density-bar { left: 10px; bottom: calc(var(--sheet) + 6px); padding: 6px 12px; }
  .density-bar input[type=range] { width: 100px; }
  .brand-name { font-size: 2.2rem; }
}

/* ---------- Compositions sauvegardées ---------- */
.saved-list { display: flex; flex-direction: column; gap: 8px; }
.saved { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); cursor: pointer; text-align: left; }
.saved:hover { border-color: var(--accent); }
.saved img { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; background: var(--wall); }
.saved .saved-name { margin: 0; font-weight: 600; font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved .saved-meta { margin: 2px 0 0; color: var(--muted); font-size: 0.72rem; }
.saved .saved-del { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 999px; }
.saved .saved-del:hover { color: var(--danger); background: var(--danger-soft); }

.save-form { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.save-form .row-btns { display: flex; gap: 8px; }
.save-form .row-btns .btn { flex: 1; }
.saved .saved-del.confirm { color: var(--on-ink); background: var(--danger); font-size: 0.7rem; font-weight: 600; padding: 4px 8px; }

/* iOS zoome automatiquement sur un champ dont la police fait moins de 16 px : on l'évite sans bloquer le zoom à deux doigts */
@media (max-width: 860px) {
  input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea { font-size: 16px; }
}
