/* Scan — interface */

:root {
  --bg: #f5f3ee;
  --surface: #fffefb;
  --surface-2: #efece5;
  --ink: #1c1b19;
  --ink-2: #4a4741;
  --muted: #8a857b;
  --line: #e4e0d6;
  --line-strong: #d3cec2;
  --accent: #1c1b19;
  --accent-ink: #fbfaf7;
  --gold: #a88a52;
  --danger: #a3412c;
  --ok: #4c7a5c;
  --shadow-sm: 0 1px 2px rgba(28, 27, 25, .05);
  --shadow: 0 1px 2px rgba(28, 27, 25, .04), 0 8px 24px -12px rgba(28, 27, 25, .18);
  --shadow-lg: 0 24px 64px -24px rgba(28, 27, 25, .35);
  --paper-shadow: 0 1px 1px rgba(28, 27, 25, .06), 0 6px 18px -8px rgba(28, 27, 25, .28);
  --scrim: rgba(28, 27, 25, .38);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Noto Serif", Georgia, serif;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --r: 14px;
  --r-lg: 22px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}

/* Thème sombre : par défaut (data-theme="dark"), ou selon le système en mode "auto" */
:root[data-theme="dark"] {
  --bg: #121211;
  --surface: #1a1918;
  --surface-2: #222120;
  --ink: #f1eee8;
  --ink-2: #c9c4ba;
  --muted: #8f8a80;
  --line: #2a2826;
  --line-strong: #383532;
  --accent: #f1eee8;
  --accent-ink: #121211;
  --gold: #c4a76f;
  --danger: #e0806b;
  --ok: #86b596;
  --shadow-sm: none;
  --shadow: 0 1px 0 rgba(255, 255, 255, .02), 0 10px 30px -16px rgba(0, 0, 0, .7);
  --shadow-lg: 0 24px 70px -20px rgba(0, 0, 0, .8);
  --paper-shadow: 0 8px 22px -10px rgba(0, 0, 0, .8);
  --scrim: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #121211;
    --surface: #1a1918;
    --surface-2: #222120;
    --ink: #f1eee8;
    --ink-2: #c9c4ba;
    --muted: #8f8a80;
    --line: #2a2826;
    --line-strong: #383532;
    --accent: #f1eee8;
    --accent-ink: #121211;
    --gold: #c4a76f;
    --danger: #e0806b;
    --ok: #86b596;
    --shadow-sm: none;
    --shadow: 0 1px 0 rgba(255, 255, 255, .02), 0 10px 30px -16px rgba(0, 0, 0, .7);
    --shadow-lg: 0 24px 70px -20px rgba(0, 0, 0, .8);
    --paper-shadow: 0 8px 22px -10px rgba(0, 0, 0, .8);
    --scrim: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

body.locked-scroll { overflow: hidden; }

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
img { display: block; max-width: 100%; }
svg { display: block; flex: none; }
a { color: inherit; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }

.noscript { text-align: center; padding: 4rem 1rem; }

#app.booting { min-height: 100vh; }

/* ------------------------------------------------------------------ typo */

.wordmark {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -.01em;
  display: inline-flex;
  align-items: baseline;
  gap: .08em;
}
.wordmark i { font-style: italic; color: var(--gold); }

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; letter-spacing: -.015em; }

/* ---------------------------------------------------------------- boutons */

.btn {
  --h: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55em;
  min-height: var(--h);
  padding: 0 1.25em;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 15px;
  font-weight: 550;
  letter-spacing: .005em;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .18s var(--ease), background-color .2s, border-color .2s, color .2s, opacity .2s, box-shadow .2s;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }

.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-sm); }
.btn-primary:hover { opacity: .9; }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--ink-2); }
.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 9%, transparent); }
.btn-lg { --h: 56px; font-size: 16px; padding: 0 1.6em; }
.btn-sm { --h: 38px; font-size: 14px; padding: 0 1em; }
.btn-block { width: 100%; }

.icon-btn {
  width: 44px; height: 44px;
  display: inline-grid; place-items: center;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  transition: background-color .2s, color .2s, transform .18s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 20px; height: 20px; }

.spinner {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------- écran PIN */

.lock {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 20px calc(32px + env(safe-area-inset-bottom));
  position: relative;
  overflow: hidden;
}
.lock::before {
  content: "";
  position: absolute; inset: auto -20% -55% -20%;
  height: 80%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--gold) 14%, transparent), transparent);
  pointer-events: none;
}
.lock-card {
  position: relative;
  width: min(100%, 380px);
  text-align: center;
  animation: rise .8s var(--ease-out) both;
}
.lock-mark {
  width: 56px; height: 72px;
  margin: 0 auto 28px;
  border-radius: 4px;
  background: var(--surface);
  box-shadow: var(--paper-shadow);
  position: relative;
  transform: rotate(-4deg);
}
.lock-mark::before, .lock-mark::after {
  content: ""; position: absolute; left: 12px; right: 12px; height: 2px; border-radius: 2px;
  background: var(--line-strong);
}
.lock-mark::before { top: 20px; box-shadow: 0 8px 0 var(--line-strong), 0 16px 0 var(--line-strong); }
.lock-mark::after { top: 46px; right: 26px; background: var(--gold); }
.lock h1 { font-size: 52px; line-height: 1; }
.lock p.lead { margin: 14px 0 40px; color: var(--muted); font-size: 15px; }

.pin-field { position: relative; }
.pin-input {
  width: 100%;
  height: 64px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  text-align: center;
  font-size: 24px;
  letter-spacing: .4em;
  padding: 0 56px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s;
}
.pin-input::placeholder { letter-spacing: .02em; font-size: 15px; color: var(--muted); }
.pin-input:focus { border-color: var(--ink-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 16%, transparent); }
.pin-toggle { position: absolute; right: 10px; top: 10px; }
.pin-error { min-height: 24px; margin: 14px 0 6px; font-size: 14px; color: var(--danger); }
.shake { animation: shake .42s var(--ease); }
@keyframes shake {
  20% { transform: translateX(-9px); } 40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); } 80% { transform: translateX(3px); }
}
.lock-foot { margin-top: 36px; font-size: 12px; color: var(--muted); }

/* --------------------------------------------------------------- layout */

.shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px calc(140px + env(safe-area-inset-bottom));
}
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 0 10px;
  margin: 0 -20px;
  padding-left: 20px; padding-right: 12px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .wordmark { font-size: 26px; }
.topbar-actions { display: flex; gap: 2px; }

.intro { padding: 36px 0 28px; animation: rise .7s var(--ease-out) both; }
.intro h2 { font-size: clamp(34px, 7vw, 52px); line-height: 1.05; }
.intro p { margin: 14px 0 0; max-width: 560px; color: var(--muted); font-size: 15px; }
.intro p strong { color: var(--ink-2); font-weight: 550; }

.status {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 20px;
  padding: 6px 12px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--surface);
}
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); position: relative; }
.status .dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  background: var(--ok); opacity: .25; animation: pulse 2.4s var(--ease) infinite;
}
.status.error .dot, .status.error .dot::after { background: var(--danger); }
@keyframes pulse { 0% { transform: scale(.5); opacity: .4; } 80%, 100% { transform: scale(1.6); opacity: 0; } }

.section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 8px 0 16px;
}

/* ----------------------------------------------------- dernière numérisation */

.feature {
  display: grid;
  grid-template-columns: minmax(120px, 210px) 1fr;
  gap: 32px;
  align-items: center;
  padding: 28px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: rise .7s .05s var(--ease-out) both;
}
.feature-info { min-width: 0; }
.feature-info h3 { font-size: clamp(26px, 4vw, 34px); line-height: 1.1; margin-top: 8px; }
.feature-meta { margin-top: 10px; color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.feature-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.feature.fresh { animation: rise .7s var(--ease-out) both, glow 2.2s .3s var(--ease) both; }
@keyframes glow {
  0% { box-shadow: var(--shadow), 0 0 0 0 color-mix(in srgb, var(--gold) 40%, transparent); }
  100% { box-shadow: var(--shadow), 0 0 0 14px transparent; }
}

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11.5px; font-weight: 600; letter-spacing: .04em;
}
.badge.gold { background: color-mix(in srgb, var(--gold) 16%, transparent); color: var(--gold); }

.expiry { display: inline-flex; align-items: center; gap: 5px; }
.expiry svg { width: 14px; height: 14px; }

/* ------------------------------------------------------------- vignette */

.paper {
  position: relative;
  aspect-ratio: 1 / 1.414;
  border-radius: 4px;
  background: #fff;
  box-shadow: var(--paper-shadow);
  overflow: hidden;
  transition: transform .35s var(--ease-out), box-shadow .35s;
}
.paper img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: top;
  opacity: 0; transition: opacity .4s;
}
.paper img.ready { opacity: 1; }
.paper.stack::before, .paper.stack::after { content: none; }
.paper-wrap { position: relative; isolation: isolate; display: block; border: 0; padding: 0; background: none; width: 100%; }
.paper-wrap.stacked::before, .paper-wrap.stacked::after {
  content: ""; position: absolute; inset: 0;
  border-radius: 4px; background: #fff;
  box-shadow: var(--paper-shadow);
}
.paper-wrap.stacked::before { transform: rotate(3deg) translate(4px, 2px); opacity: .75; }
.paper-wrap.stacked::after { transform: rotate(-2deg) translate(-3px, 3px); opacity: .9; }
.paper-wrap .paper { z-index: 1; }
.paper-wrap:hover .paper { transform: translateY(-3px); }
.pages-chip {
  position: absolute; right: 8px; bottom: 8px; z-index: 2;
  height: 22px; padding: 0 8px; border-radius: 999px;
  display: inline-flex; align-items: center;
  background: rgba(28, 27, 25, .78); color: #fff;
  font-size: 11px; font-weight: 600;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}

/* ------------------------------------------------------------- grille */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 28px 20px;
}
@media (min-width: 720px) { .grid { grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 36px 28px; } }

.card {
  position: relative;
  display: flex; flex-direction: column; gap: 14px;
  padding: 0; border: 0; background: none; text-align: left;
  animation: rise .6s var(--ease-out) both;
}
.card-info { display: flex; flex-direction: column; gap: 2px; padding: 0 2px; }
.card-title { font-family: var(--serif); font-size: 19px; line-height: 1.2; }
.card-meta { font-size: 12.5px; color: var(--muted); }

.select-mark {
  position: absolute; top: -8px; left: -8px; z-index: 3;
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); color: var(--muted);
  border: 1.5px solid var(--line-strong);
  font-size: 14px; font-weight: 700;
  box-shadow: var(--shadow);
  transform: scale(.9);
  transition: transform .25s var(--ease-out), background-color .2s, color .2s, border-color .2s;
}
.selecting .card { cursor: pointer; }
.card.selected .select-mark { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); transform: scale(1); }
.card.selected .paper { box-shadow: 0 0 0 2.5px var(--accent), var(--paper-shadow); }
.selecting .card:not(.selected) .paper { opacity: .82; }

/* ---------------------------------------------------------- état vide */

.empty {
  text-align: center;
  padding: 72px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  animation: rise .7s var(--ease-out) both;
}
.empty .lock-mark { margin-bottom: 26px; animation: float 5s var(--ease) infinite; }
.empty h3 { font-size: 28px; }
.empty p { color: var(--muted); max-width: 420px; margin: 12px auto 0; font-size: 15px; }
.steps { display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin-top: 22px; font-size: 13px; color: var(--ink-2); }
.steps span { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.steps svg { width: 14px; height: 14px; color: var(--muted); }
@keyframes float { 0%, 100% { transform: rotate(-4deg) translateY(0); } 50% { transform: rotate(-2deg) translateY(-6px); } }

/* ------------------------------------------------------------ fusion */

.merge-banner {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  margin-bottom: 26px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
  animation: rise .5s var(--ease-out) both;
}
.merge-banner .num {
  width: 34px; height: 34px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--gold) 16%, transparent); color: var(--gold);
}
.merge-banner .num svg { width: 18px; height: 18px; }
.merge-banner p { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.merge-banner strong { color: var(--ink); font-weight: 600; }

.tray {
  position: fixed; z-index: 30;
  left: 50%; bottom: calc(16px + env(safe-area-inset-bottom));
  width: min(calc(100% - 24px), 720px);
  transform: translate(-50%, 0);
  padding: 14px;
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(20px);
  backdrop-filter: saturate(1.4) blur(20px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  animation: trayIn .5s var(--ease-out) both;
}
@keyframes trayIn { from { transform: translate(-50%, 130%); } }
.tray-list { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 12px; scrollbar-width: none; }
.tray-list::-webkit-scrollbar { display: none; }
.tray-empty { font-size: 14px; color: var(--muted); padding: 6px 6px 14px; }
.chip-doc {
  flex: none;
  display: flex; align-items: center; gap: 4px;
  padding: 6px 4px;
  border-radius: 14px;
  background: var(--surface-2);
  animation: pop .35s var(--ease-out) both;
}
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.chip-doc .mini { width: 30px; height: 42px; border-radius: 3px; background: #fff; overflow: hidden; box-shadow: var(--shadow-sm); }
.chip-doc .mini img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.chip-doc .n { font-size: 12px; font-weight: 700; width: 14px; text-align: center; }
.chip-doc .icon-btn { width: 28px; height: 28px; }
.chip-doc .icon-btn[disabled] { opacity: .25; pointer-events: none; }
.chip-doc .icon-btn svg { width: 16px; height: 16px; }
.tray-actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; }
.tray-actions .btn { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tray-hint { font-size: 12.5px; color: var(--muted); padding: 0 6px 10px; }

/* ------------------------------------------------------- feuilles (modales) */

.sheet-root { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.scrim { position: absolute; inset: 0; background: var(--scrim); animation: fade .3s both; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: relative;
  width: 100%; max-width: 560px;
  max-height: calc(100dvh - 40px);
  display: flex; flex-direction: column;
  background: var(--bg);
  border-radius: 26px 26px 0 0;
  box-shadow: var(--shadow-lg);
  animation: sheetIn .45s var(--ease-out) both;
  overflow: hidden;
}
.sheet.wide { max-width: 860px; }
@keyframes sheetIn { from { transform: translateY(100%); } }
.sheet-root.closing .scrim { animation: fade .25s reverse both; }
.sheet-root.closing .sheet { animation: sheetOut .28s var(--ease) both; }
@keyframes sheetOut { to { transform: translateY(100%); } }
@media (min-width: 720px) {
  .sheet-root { align-items: center; padding: 24px; }
  .sheet { border-radius: 26px; max-height: calc(100dvh - 48px); }
  @keyframes sheetIn { from { transform: translateY(24px) scale(.98); opacity: 0; } }
  @keyframes sheetOut { to { transform: translateY(16px) scale(.98); opacity: 0; } }
}
.sheet-grip { width: 38px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 10px auto 0; }
@media (min-width: 720px) { .sheet-grip { display: none; } }
.sheet-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 16px 10px 24px;
}
.sheet-head h3 { font-size: 27px; line-height: 1.15; }
.sheet-head .sub { font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.sheet-body { overflow-y: auto; padding: 8px 24px 24px; overscroll-behavior: contain; }
.sheet-foot {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.sheet-foot .btn-primary { flex: 1 1 auto; }

/* aperçu */
.viewer { display: flex; flex-direction: column; gap: 18px; padding: 8px 0 8px; }
.viewer .paper { aspect-ratio: auto; min-height: 240px; }
.viewer .paper img { height: auto; object-fit: contain; }
.page-label { text-align: center; font-size: 12px; color: var(--muted); margin-top: -8px; }

/* formulaires */
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.field label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, .textarea {
  width: 100%;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 16px;
  transition: border-color .2s, box-shadow .2s;
}
.textarea { padding: 14px 18px; min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus { border-color: var(--ink-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 14%, transparent); }
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; min-width: 0; }
.hint { font-size: 12.5px; color: var(--muted); }
.form-error { color: var(--danger); font-size: 14px; min-height: 20px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 42px; padding: 0 16px 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 14.5px;
  transition: background-color .2s, color .2s, border-color .2s, transform .15s var(--ease);
}
.chip:active { transform: scale(.96); }
.chip .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink-2);
  font-size: 11.5px; font-weight: 700;
  transition: background-color .2s, color .2s;
}
.chip .avatar svg { width: 14px; height: 14px; }
.chip small { color: var(--muted); font-size: 12px; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip.on small { color: color-mix(in srgb, var(--accent-ink) 65%, transparent); }
.chip.on .avatar { background: var(--accent-ink); color: var(--accent); }

.segmented {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  padding: 4px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.segmented button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink-2);
  font-size: 14px; font-weight: 550;
  transition: background-color .25s var(--ease), color .2s, box-shadow .25s;
}
.segmented button svg { width: 16px; height: 16px; }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.divider { height: 1px; background: var(--line); margin: 8px 0 24px; }

.list { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px 10px 14px; }
.list-row + .list-row { border-top: 1px solid var(--line); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .t { font-size: 15px; }
.list-row .s { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-empty { padding: 18px; font-size: 14px; color: var(--muted); text-align: center; }

.settings-section { margin-bottom: 34px; }
.settings-section h4 { font-family: var(--serif); font-weight: 400; font-size: 22px; margin: 0 0 6px; }
.settings-section > p { margin: 0 0 16px; font-size: 13.5px; color: var(--muted); }

.done { text-align: center; padding: 36px 8px 20px; }
.done-mark {
  width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 20px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok);
  animation: pop .5s var(--ease-out) both;
}
.done-mark svg { width: 34px; height: 34px; stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .5s .2s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.done h3 { font-size: 28px; }
.done p { color: var(--muted); margin: 8px 0 0; }

/* -------------------------------------------------------------- toasts */

#toasts {
  position: fixed; z-index: 80;
  left: 50%; top: calc(14px + env(safe-area-inset-top));
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
  width: min(calc(100% - 24px), 420px);
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px 12px 14px;
  border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .45s var(--ease-out) both;
}
.toast svg { width: 18px; height: 18px; }
.toast.error svg { color: var(--danger); }
.toast.out { animation: toastOut .3s var(--ease) both; }
@keyframes toastIn { from { transform: translateY(-16px) scale(.96); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(-10px); opacity: 0; } }

/* ------------------------------------------------------------- utilitaires */

@keyframes rise { from { transform: translateY(12px); opacity: 0; } }

.foot { margin-top: 72px; text-align: center; font-size: 12px; color: var(--muted); }

@media (max-width: 620px) {
  .shell { padding-left: 16px; padding-right: 16px; }
  .topbar { margin: 0 -16px; padding-left: 16px; padding-right: 8px; }
  .intro { padding: 22px 0 22px; }
  .feature { grid-template-columns: 1fr; gap: 24px; padding: 20px; }
  .feature .paper-wrap { max-width: 210px; margin: 6px auto 0; }
  .feature-info { text-align: center; }
  .feature-meta { justify-content: center; }
  .feature-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .feature-actions .btn-primary { grid-column: 1 / -1; }
  .sheet-head { padding-left: 20px; }
  .sheet-body { padding-left: 20px; padding-right: 20px; }
  .section-head .btn span.long { display: none; }
}

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