/* =========================================================
   Bibliothèque numérique — design sobre et moderne
   Clair / sombre automatique · mobile d'abord · PWA iPhone
   ========================================================= */
:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #efeee9;
  --ink: #1c1d21;
  --ink-2: #3a3c42;
  --muted: #6b6e76;
  --line: #e3e1db;
  --accent: #2f5d50;
  --accent-ink: #ffffff;
  --accent-soft: #e2ebe7;
  --danger: #b42318;
  --danger-soft: #fbeceb;
  --warn-bg: #fdf4e2;
  --warn-ink: #7a5000;
  --ok-bg: #e6f2eb;
  --ok-ink: #1d6440;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 20, 25, .05), 0 6px 20px rgba(20, 20, 25, .05);
  --cover-shadow: 0 1px 2px rgba(0, 0, 0, .10), 0 6px 16px rgba(0, 0, 0, .10);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --tabbar-h: 58px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141518;
    --surface: #1c1d21;
    --surface-2: #25262c;
    --ink: #ecebe8;
    --ink-2: #c9c8c4;
    --muted: #9a9ca4;
    --line: #2d2f35;
    --accent: #84c7b2;
    --accent-ink: #0f1f1a;
    --accent-soft: #1f2e29;
    --danger: #f08a80;
    --danger-soft: #3a2220;
    --warn-bg: #3a2f17;
    --warn-ink: #f2cf86;
    --ok-bg: #1b3326;
    --ok-ink: #9ad7b2;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --cover-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 16px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
a { color: inherit; }
a:not([class]) { color: var(--accent); text-decoration: none; }
a:not([class]):hover { text-decoration: underline; }
img { max-width: 100%; }
code { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
h1, h2, h3 { letter-spacing: -.015em; line-height: 1.25; }
.ic { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; justify-content: center; }
.break { word-break: break-word; }
.inline { display: inline-flex; margin: 0; }
.row-gap { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* ---------- Barre supérieure ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-in { max-width: 1180px; margin: 0 auto; height: 56px; padding: 0 20px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; }
.brand img { border-radius: 7px; }
.topnav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.topnav a { text-decoration: none; padding: 7px 12px; border-radius: 8px; color: var(--ink-2); font-size: 14px; font-weight: 500; }
.topnav a:hover { background: var(--surface-2); }
.topnav a.on { color: var(--ink); background: var(--surface-2); }
.topnav a.btn { margin-left: 8px; color: var(--accent-ink); background: var(--accent); }

/* ---------- Barre d'onglets (mobile) ---------- */
.tabbar { display: none; }
@media (max-width: 760px) {
  .topnav { display: none; }
  .topbar-in { height: 50px; justify-content: center; }
  .brand { font-size: 16px; }
  .tabbar {
    display: flex; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    border-top: 1px solid var(--line);
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: 10.5px; font-weight: 500; }
  .tabbar a .ic { width: 23px; height: 23px; }
  .tabbar a.on { color: var(--accent); }
  .wrap { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px) !important; }
}

/* ---------- Mise en page ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 20px 60px; padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
.page-title { font-size: 26px; margin: 4px 0 16px; font-weight: 700; }
.lead { max-width: 680px; margin-top: -6px; }
.h-sm { font-size: 16px; font-weight: 650; margin: 26px 0 12px; display: flex; align-items: center; gap: 8px; }
.card .h-sm:first-child { margin-top: 0; }
.backlink { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 14px; margin: 0 0 10px -4px; padding: 4px; }
.backlink:hover { color: var(--ink); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 500 14.5px var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 8px; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-sm.btn-icon { width: 34px; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger-soft); }
.btn-danger-soft { color: var(--danger); background: var(--danger-soft); border-color: transparent; margin-top: 8px; }
.btn.is-fav { color: #c98a00; border-color: #e9c46a; background: color-mix(in srgb, #e9c46a 16%, var(--surface)); }
.btn.is-fav .ic { fill: currentColor; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- Formulaires ---------- */
.form label, .form .field { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 550; color: var(--ink-2); margin-bottom: 14px; }
.form .lbl { font-size: 13.5px; font-weight: 550; }
input[type=text], input[type=email], input[type=password], input[type=search], input:not([type]), select, textarea {
  width: 100%; height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
  font: 400 16px var(--font); /* 16px : évite le zoom automatique sur iPhone */
  outline: none; transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
select {
  padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
textarea { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type=color] { width: 44px; height: 44px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; flex: none; }
.form .check, .check { flex-direction: row !important; align-items: center; gap: 9px !important; font-weight: 450 !important; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; }
.check-lg { align-self: end; min-height: 44px; }
.grid2, .grid3 { display: grid; gap: 0 14px; grid-template-columns: 1fr 1fr; }
.grid3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } .grid3.keep, .grid2.keep { grid-template-columns: 1fr 1fr; } }
fieldset { border: 0; padding: 0; margin: 0 0 8px; }
legend { font-weight: 650; font-size: 15px; margin-bottom: 8px; }
.hint { font-size: 13px; color: var(--muted); margin: -4px 0 12px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.form-inline { display: flex; gap: 10px; align-items: center; }
.select-sm { height: 34px; font-size: 13.5px; width: auto; max-width: 220px; }

/* Contrôle segmenté */
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; flex: none; }
.seg a, .seg label span { display: block; padding: 6px 13px; border-radius: 8px; text-decoration: none; font-size: 14px; font-weight: 500; color: var(--muted); white-space: nowrap; cursor: pointer; }
.seg a.on, .seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.seg-radio { display: flex; width: 100%; }
.seg-radio label { flex: 1; margin: 0 !important; }
.seg-radio label span { text-align: center; padding: 8px 6px; }
.seg-radio input { position: absolute; opacity: 0; pointer-events: none; }

/* ---------- Alertes ---------- */
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; border: 1px solid transparent; transition: opacity .4s; }
.alert ul { margin: 6px 0; padding-left: 20px; }
.alert-ok { background: var(--ok-bg); color: var(--ok-ink); }
.alert-err { background: var(--danger-soft); color: var(--danger); }
.alert-warn { background: var(--warn-bg); color: var(--warn-ink); }
.alert a { color: inherit; font-weight: 600; text-decoration: underline; }
.alert .check { margin-top: 8px; color: inherit; }

/* ---------- Recherche & filtres ---------- */
.searchbar { margin: 4px 0 18px; }
.search-field { position: relative; display: flex; align-items: center; }
.search-field > .ic { position: absolute; left: 14px; color: var(--muted); pointer-events: none; width: 19px; height: 19px; }
.search-field input { height: 48px; padding-left: 44px; padding-right: 44px; border-radius: 12px; font-size: 16px; background: var(--surface); box-shadow: var(--shadow); border-color: transparent; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-field .clear { position: absolute; right: 8px; width: 32px; height: 32px; display: grid; place-items: center; color: var(--muted); border-radius: 8px; }
.filters { display: flex; gap: 8px; margin-top: 12px; align-items: center; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.filters::-webkit-scrollbar { display: none; }
.filters select { width: auto; height: 38px; font-size: 14px; border-radius: 10px; flex: none; max-width: 230px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; flex: none; }
.chip .ic { width: 16px; height: 16px; }
.chip.on { background: color-mix(in srgb, #e9c46a 18%, var(--surface)); border-color: #e9c46a; color: #a06e00; }
.chip.on .ic { fill: currentColor; }

/* ---------- Statistiques ---------- */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; }
.stats div { background: var(--surface); padding: 14px 16px; display: flex; flex-direction: column; }
.stats strong { font-size: 21px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12.5px; color: var(--muted); }
@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stats div:nth-child(n+4) { display: none; }
  .stats div { padding: 10px 12px; }
  .stats strong { font-size: 18px; }
}
.notice { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-ink); text-decoration: none; margin-bottom: 18px; font-size: 14px; }
.notice span { flex: 1; }

.results-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.results-head p { margin: 0; font-size: 14px; }
.viewtoggle { display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 9px; }
.viewtoggle a { width: 32px; height: 28px; display: grid; place-items: center; border-radius: 7px; color: var(--muted); }
.viewtoggle a .ic { width: 16px; height: 16px; }
.viewtoggle a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }

/* ---------- Couvertures ---------- */
.cover { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 6px; box-shadow: var(--cover-shadow); background: var(--surface-2); }
.cover-ph {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 14% 11% 11%;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 92%, #fff) 0%, var(--c) 55%, color-mix(in srgb, var(--c) 78%, #000) 100%);
  color: #fff;
}
.cover-ph::before { content: ""; position: absolute; left: 7%; top: 0; bottom: 0; width: 1px; background: rgba(255, 255, 255, .18); }
.cover-ph::after { content: ""; position: absolute; left: 11%; right: 11%; top: 9%; height: 1.5px; background: rgba(255, 255, 255, .45); }
.ph-title { font-family: var(--serif); font-weight: 600; font-size: clamp(11px, 1.05vw, 15px); line-height: 1.22; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.ph-author { font-size: clamp(9px, .8vw, 11.5px); opacity: .82; text-transform: uppercase; letter-spacing: .06em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cover-xs { width: 42px; flex: none; border-radius: 4px; }
.cover-xs.cover-ph { padding: 5px; }
.cover-xs .ph-title { font-size: 6px; -webkit-line-clamp: 4; }
.cover-xs .ph-author, .cover-xs.cover-ph::after, .cover-xs.cover-ph::before { display: none; }
.cover-lg { border-radius: 8px; }
.cover-lg .ph-title { font-size: 22px; }
.cover-lg .ph-author { font-size: 13px; }

/* ---------- Grille ---------- */
.grid-books { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 26px 20px; }
.grid-books-sm { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
@media (max-width: 760px) { .grid-books { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 20px 14px; } }
@media (max-width: 380px) { .grid-books { grid-template-columns: repeat(3, 1fr); gap: 18px 10px; } }
.book-card { text-decoration: none; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.cover-wrap { position: relative; transition: transform .2s ease; }
.book-card:hover .cover-wrap { transform: translateY(-3px); }
.book-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.book-meta .t { font-size: 13.5px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-meta .a { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-badge, .type-badge, .read-badge { position: absolute; display: grid; place-items: center; }
.fav-badge { top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; background: rgba(0, 0, 0, .45); color: #f6c453; backdrop-filter: blur(4px); }
.fav-badge .ic { width: 13px; height: 13px; fill: currentColor; }
.type-badge { left: 6px; bottom: 6px; padding: 2px 7px; font-size: 10.5px; font-weight: 600; border-radius: 5px; background: rgba(255, 255, 255, .92); color: #222; letter-spacing: .02em; }
.read-badge { right: 6px; bottom: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; }

/* ---------- Liste ---------- */
.list-books { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.book-row { display: flex; align-items: center; gap: 14px; padding: 10px 14px; text-decoration: none; border-bottom: 1px solid var(--line); }
.book-row:last-child { border-bottom: 0; }
.book-row:hover { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-main strong { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row-main a { text-decoration: none; }
.row-main .muted { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.star-inline .ic { width: 13px; height: 13px; color: #e0a800; fill: currentColor; vertical-align: -1px; }
@media (max-width: 560px) { .row-side .pill { display: none; } }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 550; text-decoration: none; white-space: nowrap;
  background: color-mix(in srgb, var(--c, #888) 14%, var(--surface)); color: color-mix(in srgb, var(--c, #888) 75%, var(--ink)); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c, #888); }
.pill-plain { background: var(--surface-2); color: var(--ink-2); }
.pill-plain::before { display: none; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; }

/* ---------- Vide & pagination ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty > .ic { width: 44px; height: 44px; opacity: .5; }
.empty h2 { color: var(--ink); font-size: 19px; margin: 12px 0 4px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 32px; font-size: 14px; }

/* ---------- Fiche document ---------- */
.detail { display: grid; grid-template-columns: 260px 1fr; gap: 40px; align-items: start; }
.detail-cover { position: sticky; top: 80px; }
.detail-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.detail-title { font-size: 30px; margin: 0 0 6px; font-weight: 700; }
.detail-author { font-size: 17px; margin: 0 0 22px; color: var(--ink-2); }
.detail-author a { color: inherit; text-decoration: none; }
.detail-author a:hover { text-decoration: underline; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.actions .btn-primary { min-width: 120px; }
.actions-sub { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.status-seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; margin-bottom: 20px; }
.status-seg button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; font: 500 13.5px var(--font); color: var(--muted); cursor: pointer; }
.status-seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.description { font-size: 15px; line-height: 1.65; color: var(--ink-2); margin-bottom: 22px; max-width: 680px; }
.meta { display: grid; grid-template-columns: 130px 1fr; gap: 10px 16px; margin: 0; font-size: 14px; max-width: 680px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags a { background: var(--surface-2); padding: 2px 9px; border-radius: 6px; font-size: 13px; text-decoration: none; color: var(--ink-2); }
.related { margin-top: 48px; }
@media (max-width: 760px) {
  .detail { grid-template-columns: 1fr; gap: 22px; }
  .detail-cover { position: static; width: 52%; max-width: 220px; margin: 0 auto; }
  .detail-title { font-size: 23px; text-align: center; }
  .detail-author, .detail-badges { text-align: center; justify-content: center; }
  .actions { justify-content: center; }
  .actions .btn-primary { flex: 1; }
  .status-seg { display: flex; }
  .status-seg button { flex: 1; }
  .meta { grid-template-columns: 100px 1fr; }
}

/* ---------- Édition ---------- */
.edit-layout { display: grid; grid-template-columns: 240px 1fr; gap: 32px; align-items: start; }
.edit-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 80px; }
@media (max-width: 760px) { .edit-layout { grid-template-columns: 1fr; gap: 18px; } .edit-side { position: static; } }
.drop { position: relative; border: 1.5px dashed color-mix(in srgb, var(--muted) 50%, transparent); border-radius: var(--radius); background: var(--surface); transition: border-color .15s, background .15s; }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.drop-inner { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px 14px; text-align: center; pointer-events: none; }
.drop-inner .ic { width: 26px; height: 26px; color: var(--accent); margin-bottom: 4px; }
.drop-inner strong { font-size: 14px; word-break: break-word; }
.drop.over, .drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.drop-big .drop-inner { padding: 44px 20px; }
.drop-big .drop-inner .ic { width: 34px; height: 34px; }
.cover-edit { display: flex; flex-direction: column; gap: 10px; }
.cover-preview { width: 100%; max-width: 240px; }
.cover-preview img { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 6px; box-shadow: var(--cover-shadow); }
@media (max-width: 760px) { .cover-edit { flex-direction: row; align-items: center; } .cover-preview { width: 96px; flex: none; } }
.cover-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dup-live { margin: -6px 0 14px; padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-ink); font-size: 13.5px; }
.dup-live a { color: inherit; font-weight: 600; }
.dup-live ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- Import ---------- */
.import-summary { margin: 22px 0 10px; }
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.import-list { list-style: none; padding: 0; margin: 0; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
.import-list:empty { display: none; }
.import-list li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.import-list li:last-child { border-bottom: 0; }
.import-list .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.import-list .nm strong { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.import-list .nm span { font-size: 12.5px; color: var(--muted); }
.import-list .st { font-size: 12.5px; font-weight: 600; white-space: nowrap; padding: 3px 9px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.import-list .st.ok { background: var(--ok-bg); color: var(--ok-ink); }
.import-list .st.dup { background: var(--warn-bg); color: var(--warn-ink); }
.import-list .st.err { background: var(--danger-soft); color: var(--danger); }
.import-list .st.run { background: var(--accent-soft); color: var(--accent); }
.import-list .st a { color: inherit; }

/* ---------- Catégories, doublons, utilisateurs ---------- */
.list-plain { padding: 4px 0; }
.cat-row, .user-row, .dup-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.cat-row:last-child, .user-row:last-child, .dup-row:last-child { border-bottom: 0; }
.cat-edit { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 220px; margin: 0; }
.cat-edit input[type=color] { width: 36px; height: 36px; }
.cat-edit input:not([type=color]) { height: 38px; }
.cat-row .count { margin-left: auto; font-size: 13px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.cat-row > strong { flex: 1; }
.cat-row form.inline { gap: 6px; align-items: center; }
.dup-group { padding: 0; overflow: hidden; }
.dup-row { flex-wrap: nowrap; }
@media (max-width: 560px) { .dup-row { flex-wrap: wrap; } .dup-row .row-main { flex-basis: calc(100% - 60px); } }
.count-badge { font-size: 12px; background: var(--surface-2); color: var(--muted); padding: 1px 8px; border-radius: 99px; font-weight: 600; }

/* ---------- Réglages ---------- */
.menu-list { padding: 4px 0; }
.menu-list a { display: flex; align-items: center; gap: 12px; padding: 13px 16px; text-decoration: none; border-bottom: 1px solid var(--line); }
.menu-list a:last-child { border-bottom: 0; }
.menu-list a:hover { background: var(--surface-2); }
.menu-list a > .ic:first-child { color: var(--accent); }
.menu-list a span { flex: 1; font-weight: 500; }
.menu-list em { font-style: normal; color: var(--muted); font-size: 13.5px; }
.menu-list em.warn { background: var(--warn-bg); color: var(--warn-ink); padding: 1px 8px; border-radius: 99px; font-weight: 600; }
.menu-list a > .ic:last-child { color: var(--muted); width: 16px; }
.steps { margin: 0 0 8px; padding-left: 20px; }
.steps li { margin: 4px 0; }
.version { margin-top: 18px; }

/* ---------- Pages d'authentification / installation ---------- */
body.auth { display: grid; place-items: center; padding: 24px 16px; padding-top: max(24px, env(safe-area-inset-top)); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 30px 26px; box-shadow: var(--shadow); }
.auth-card.wide { max-width: 640px; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 550; color: var(--ink-2); margin-bottom: 14px; }
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-head img { border-radius: 13px; box-shadow: var(--cover-shadow); }
.auth-head h1 { font-size: 22px; margin: 14px 0 4px; }
.auth-head p { margin: 0; font-size: 14px; }
.checks { list-style: none; padding: 0; margin: 0 0 18px; font-size: 14px; }
.checks li { padding: 5px 0 5px 26px; position: relative; }
.checks li::before { position: absolute; left: 0; font-weight: 700; }
.checks li.ok::before { content: "✓"; color: var(--ok-ink); }
.checks li.ko::before { content: "✕"; color: var(--danger); }
.checks li.warn::before { content: "!"; color: var(--warn-ink); left: 4px; }

/* ---------- Divers ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 60; box-shadow: var(--shadow); }
@media (min-width: 761px) { .toast { bottom: 24px; } }
@media (hover: none) { .book-card:hover .cover-wrap { transform: none; } }
.link-btn { border: 0; background: none; color: var(--accent); font: 500 13px var(--font); cursor: pointer; padding: 0 4px; }
.checks .fix { display: block; margin-top: 4px; font-size: 13px; color: var(--danger); line-height: 1.45; }
