/* Librarium – thème. Polices hébergées localement (OFL, voir assets/fonts/LICENCES.txt). */

@font-face { font-family: "Cormorant Garamond"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/cormorant-garamond-600.woff2") format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/cormorant-garamond-700.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/inter-400.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/inter-500.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/inter-600.woff2") format("woff2"); }

/* ---------- Thème clair « papier » (par défaut) ---------- */
:root {
  --paper: #F5EFE3;
  --vellum: #FBF7EE;
  --ink: #2A2118;
  --brand: #1F3D36;
  --brand-ink: #F5EFE3;
  --accent: #6B2737;
  --gold: #B08D3C;
  --gold-text: #7A5C1E;
  --border: #D9CDB4;
  --muted: #6B5D4A;
  --success-bg: #E4EDE6;
  --error-bg: #F3E1E3;
  --wood: #8C6A43;
  --wood-dark: #6E5233;
  --shadow: 0 1px 2px rgba(42, 33, 24, .08), 0 6px 18px rgba(42, 33, 24, .08);
  --book-shadow: 0 2px 4px rgba(42, 33, 24, .3);
  --cover-edge: transparent;

  --font-title: "Cormorant Garamond", Garamond, "Times New Roman", serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 6px;
  --tap: 48px;
  --tabbar-h: 72px;
  color-scheme: light;
}

/* ---------- Thème sombre « bibliothèque de nuit » : réglage du téléphone ou choix forcé ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    --paper: #16130F; --vellum: #201B15; --ink: #EDE3D0; --brand: #6FA08F; --brand-ink: #16130F;
    --accent: #C97B8A; --gold: #D2AE5E; --gold-text: #D2AE5E; --border: #3A3228; --muted: #A99C84;
    --success-bg: #1F2B25; --error-bg: #33201F; --wood: #5A4430; --wood-dark: #3E2F20;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3);
    --book-shadow: 0 2px 5px rgba(0, 0, 0, .55);
    --cover-edge: rgba(237, 227, 208, .16);
    color-scheme: dark;
  }
}
:root[data-theme="sombre"] {
  --paper: #16130F; --vellum: #201B15; --ink: #EDE3D0; --brand: #6FA08F; --brand-ink: #16130F;
  --accent: #C97B8A; --gold: #D2AE5E; --gold-text: #D2AE5E; --border: #3A3228; --muted: #A99C84;
  --success-bg: #1F2B25; --error-bg: #33201F; --wood: #5A4430; --wood-dark: #3E2F20;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3);
  --book-shadow: 0 2px 5px rgba(0, 0, 0, .55);
  --cover-edge: rgba(237, 227, 208, .16);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }
button { font-family: inherit; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: .5rem; top: -3rem; z-index: 50; padding: .6rem 1rem; background: var(--brand); color: var(--brand-ink); border-radius: var(--radius); }
.skip:focus { top: .5rem; }

/* ---------- Titres et textes ---------- */
.title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: clamp(1.75rem, 6vw, 2.4rem);
  line-height: 1.1;
  margin: .1em 0 .3em;
}
.title--center { text-align: center; }
.subtitle {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.5rem;
  margin: 2rem 0 .75rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--border);
}
.lead { color: var(--muted); text-align: center; margin: 0 0 1.25rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .02em; }

.ornament { display: flex; align-items: center; gap: .75rem; margin: 0 0 1.5rem; }
.ornament::before, .ornament::after { content: ""; flex: 1; height: 1px; background: var(--gold); opacity: .7; }
.ornament span { width: 7px; height: 7px; background: var(--gold); transform: rotate(45deg); }

/* ---------- Formulaires ---------- */
.form { display: grid; gap: 1rem; }
.form--inline { grid-template-columns: 1fr; align-items: end; }
@media (min-width: 640px) { .form--inline { grid-template-columns: 1fr auto; } }
.field { display: grid; gap: .35rem; }
.field__label { font-size: .9rem; font-weight: 600; }
.field__help { font-size: .8rem; color: var(--muted); }

input[type="email"], input[type="password"], input[type="text"], input[type="search"] {
  font: 1rem/1.3 var(--font-ui);
  min-height: var(--tap);
  width: 100%;
  padding: .7rem .85rem;
  color: var(--ink);
  background: var(--vellum);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  -webkit-appearance: none;
  appearance: none;
}
input:focus { border-color: var(--brand); outline: 2px solid var(--brand); outline-offset: 0; }
input[readonly] { color: var(--muted); }
input::placeholder { color: var(--muted); opacity: 1; }

.check { display: flex; align-items: center; gap: .65rem; min-height: var(--tap); font-size: .95rem; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--brand); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--tap);
  padding: .65rem 1.2rem;
  font: 600 1rem/1.2 var(--font-ui);
  color: var(--ink);
  background: var(--vellum);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: var(--brand); color: var(--ink); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn--primary:hover { background: var(--accent); border-color: var(--accent); color: var(--brand-ink); }
.btn--ghost { background: transparent; }
.btn--small { min-height: 44px; padding: .45rem .9rem; font-size: .9rem; }
.btn--block { width: 100%; }
.inline { display: inline; margin: 0; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex: none;
  padding: 0;
  color: var(--ink);
  background: var(--vellum);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.icon-btn--round { border-radius: 50%; color: var(--brand); }
.icon-btn[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* ---------- Messages ---------- */
.notice {
  margin: 0 0 1rem;
  padding: .8rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--success-bg);
  font-size: .95rem;
}
.notice p { margin: 0 0 .5rem; }
.notice p:last-child { margin-bottom: 0; }
.notice--error { background: var(--error-bg); }
.notice--info { background: var(--vellum); }
.copy-row { display: flex; gap: .5rem; margin-top: .5rem; }
.copy-row input { flex: 1; font-size: .85rem; }

/* ---------- Connexion : vignette ex-libris ---------- */
.auth { display: grid; place-items: center; padding: 1.25rem; }
.exlibris { width: 100%; max-width: 440px; }
.exlibris__frame {
  background: var(--vellum);
  border: 1px solid var(--gold);
  outline: 1px solid var(--gold);
  outline-offset: 5px;
  border-radius: 2px;
  padding: 2rem 1.5rem 1.75rem;
  margin: 6px;
  box-shadow: var(--shadow);
}
.exlibris__logo { display: flex; justify-content: center; color: var(--brand); }
.exlibris__svg { width: 170px; height: auto; }
.exlibris__motto { margin: .5rem 0 1rem; text-align: center; font-family: var(--font-title); font-weight: 600; font-style: italic; color: var(--gold-text); letter-spacing: .12em; }
.auth__links { text-align: center; margin: 1.25rem 0 0; font-size: .95rem; }
.auth__links a { display: inline-block; padding: .6rem; }
.auth__hint { text-align: center; margin: .25rem 0 0; color: var(--muted); font-size: .85rem; }

/* ---------- Bandeau du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 64px;
  padding: 0 1.25rem;
  padding-top: env(safe-area-inset-top);
  background: var(--paper);
  border-bottom: 1px solid var(--border);
}
.topbar__brand { display: flex; align-items: center; min-height: var(--tap); color: var(--brand); }
.topbar__logo { height: 28px; width: auto; }
.link-quiet { display: inline-flex; align-items: center; gap: .25rem; color: var(--muted); text-decoration: none; padding: .7rem 0; }
.link-quiet:hover { color: var(--brand); }

/* Menu du compte */
.account { position: relative; }
.account > summary { list-style: none; }
.account > summary::-webkit-details-marker { display: none; }
.account__menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: min(290px, calc(100vw - 2rem));
  padding: .75rem;
  background: var(--vellum);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.account__who { margin: 0 0 .75rem; padding: 0 .25rem .75rem; border-bottom: 1px solid var(--border); font-weight: 600; }
.account__who span { display: block; font-weight: 400; font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.account__link {
  display: flex; align-items: center; width: 100%; min-height: 44px;
  padding: 0 .25rem; margin: 0;
  font: 500 .95rem var(--font-ui); color: var(--ink); text-decoration: none;
  background: none; border: 0; cursor: pointer; text-align: left;
}
.account__link:hover { color: var(--accent); }
.theme-pick { border: 0; margin: 0 0 .5rem; padding: 0; }
.theme-pick legend { padding: 0 .25rem .35rem; font-size: .8rem; color: var(--muted); }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: flex; align-items: center; justify-content: center; min-height: 44px; font-size: .9rem; font-weight: 500; }
.segmented label + label span { border-left: 1px solid var(--border); }
.segmented input:checked + span { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.segmented input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: -3px; }

/* ---------- Page ---------- */
.page { width: 100%; max-width: 1100px; margin: 0 auto; padding: 1rem 1.25rem 2.5rem; }
.app--nav .page { padding-bottom: calc(var(--tabbar-h) + 2.5rem + env(safe-area-inset-bottom)); }

/* ---------- Barre de navigation du bas ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: flex-end; justify-content: space-around;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 0 1rem env(safe-area-inset-bottom);
  background: var(--vellum);
  border-top: 1px solid var(--border);
}
.tabbar__item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  width: 84px; height: 64px;
  color: var(--muted); text-decoration: none;
  font-size: .75rem; font-weight: 500;
}
.tabbar__item[aria-current="page"] { color: var(--brand); font-weight: 600; }
.tabbar__item:hover { color: var(--brand); }
.tabbar__item--scan { justify-content: flex-start; height: 72px; color: var(--brand); font-weight: 600; }
.tabbar__scan {
  display: flex; align-items: center; justify-content: center;
  width: 60px; height: 60px; margin-top: -22px;
  border-radius: 50%;
  background: var(--brand); color: var(--brand-ink);
  border: 3px solid var(--gold);
  box-shadow: 0 3px 8px rgba(42, 33, 24, .3);
}
@media (min-width: 900px) {
  .tabbar { left: 50%; right: auto; transform: translateX(-50%); width: 420px; border: 1px solid var(--border); border-bottom: 0; border-radius: 12px 12px 0 0; }
}

/* ---------- Ma bibliothèque ---------- */
.library__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; column-gap: 1rem; }
.library__count { margin: 0 0 .5rem; font-size: .9rem; }

.toolbar { display: flex; gap: .5rem; align-items: center; margin: .25rem 0 .5rem; }
.search { position: relative; flex: 1; display: flex; align-items: center; }
.search__icon { position: absolute; left: 12px; display: flex; color: var(--muted); pointer-events: none; }
.search input { min-height: 44px; padding-left: 40px; font-size: 15px; }
.view-toggle { display: flex; gap: .5rem; }

.chips {
  display: flex; gap: .5rem;
  margin: 0 -1.25rem .75rem; padding: .25rem 1.25rem;
  overflow-x: auto; scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  min-height: 44px; padding: 0 1.1rem;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--vellum); color: var(--ink);
  font-size: .875rem; font-weight: 500;
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }

/* Étagère : couvertures posées sur des planches */
.shelf {
  list-style: none; margin: 0 -.4rem; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  row-gap: 14px;
}
@media (min-width: 700px) { .shelf { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); row-gap: 20px; } }
.book { display: block; color: var(--ink); text-decoration: none; }
.book__cover { display: block; padding: 0 .4rem; }
.book__cover::after {
  content: ""; display: block; height: 7px; margin: 0 -.4rem;
  background: var(--wood);
  box-shadow: 0 3px 4px rgba(42, 33, 24, .22);
}
.book__text { display: block; padding: .5rem .4rem 0; min-width: 0; }
.book__title, .book__author { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book__title { font-size: .8rem; font-weight: 600; line-height: 1.25; }
.book__author { font-size: .74rem; line-height: 1.25; color: var(--muted); }
.book__genre { display: none; }
.book:hover .book__title { color: var(--accent); }
.book:focus-visible { outline-offset: 4px; }

/* Couvertures */
.cover { display: block; width: 100%; aspect-ratio: 2 / 3; border-radius: 2px 4px 4px 2px; box-shadow: var(--book-shadow), 0 0 0 1px var(--cover-edge); }
.cover--img { object-fit: cover; background: var(--border); }
.cover--generic {
  container-type: inline-size;
  display: flex; padding: 6%;
  background: var(--c-bg); color: var(--c-fg);
}
.cover__frame {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7%;
  padding: 8% 6%;
  border: 1px solid var(--c-line);
  text-align: center;
  overflow: hidden;
}
.cover__rule { width: 20%; height: 1px; background: var(--c-line); flex: none; }
.cover__title {
  font-family: var(--font-title); font-weight: 700;
  font-size: clamp(11px, 15cqw, 26px); line-height: 1.08;
  overflow-wrap: break-word; hyphens: auto;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.cover__author { font-size: clamp(7px, 7.5cqw, 13px); line-height: 1.2; opacity: .85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tone-0 { --c-bg: #1F3D36; --c-fg: #D2AE5E; --c-line: #B08D3C; }
.tone-1 { --c-bg: #6B2737; --c-fg: #EBDDB8; --c-line: #D2AE5E; }
.tone-2 { --c-bg: #3B2F24; --c-fg: #D8BE82; --c-line: #B08D3C; }
.tone-3 { --c-bg: #7A5C1E; --c-fg: #F5EFE3; --c-line: #E3C98A; }
.tone-4 { --c-bg: #F0E4C8; --c-fg: #6B2737; --c-line: #B08D3C; }
.tone-5 { --c-bg: #2A2118; --c-fg: #EDE3D0; --c-line: #B08D3C; }
.tone-6 { --c-bg: #14302A; --c-fg: #D2AE5E; --c-line: #B08D3C; }
.tone-7 { --c-bg: #8A3A46; --c-fg: #F3E7C9; --c-line: #E3C98A; }
.tone-8 { --c-bg: #C9B58A; --c-fg: #2A2118; --c-line: #6B2737; }

/* Vue liste */
[data-vue="liste"] .shelf { display: block; margin: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--vellum); }
[data-vue="liste"] .shelf__item + .shelf__item { border-top: 1px solid var(--border); }
[data-vue="liste"] .shelf .book { display: flex; align-items: center; gap: .85rem; padding: .55rem .75rem; min-height: 72px; }
[data-vue="liste"] .shelf .book__cover { width: 40px; flex: none; padding: 0; }
[data-vue="liste"] .shelf .book__cover::after { display: none; }
[data-vue="liste"] .shelf .cover { box-shadow: 0 1px 2px rgba(42, 33, 24, .25); }
[data-vue="liste"] .shelf .cover__frame { padding: 0; border: 0; }
[data-vue="liste"] .shelf .cover__title, [data-vue="liste"] .shelf .cover__author, [data-vue="liste"] .shelf .cover__rule { display: none; }
[data-vue="liste"] .shelf .book__text { flex: 1; padding: 0; }
[data-vue="liste"] .shelf .book__title { font-size: .95rem; white-space: normal; }
[data-vue="liste"] .shelf .book__author { font-size: .85rem; }
[data-vue="liste"] .shelf .book__genre { display: block; font-size: .78rem; color: var(--gold-text); margin-top: 2px; }

.no-result { text-align: center; color: var(--muted); padding: 2rem 0; }

.empty-shelf { text-align: center; padding: 2rem 0 0; }
.empty-shelf__text { font-family: var(--font-title); font-weight: 600; font-size: 1.5rem; margin: 0 0 .25rem; }
.shelf-board {
  height: 18px; margin: 2.5rem auto 0; max-width: 520px;
  background: linear-gradient(var(--wood), var(--wood-dark));
  border-radius: 2px;
  box-shadow: 0 6px 10px rgba(42, 33, 24, .18);
}

/* ---------- Fiche livre ---------- */
.fiche { max-width: 720px; margin: 0 auto; }
.fiche__back { margin: 0 0 .25rem; font-size: .9rem; }
.readonly-badge { display: inline-block; margin: 0 0 1rem; padding: .3rem .7rem; border: 1px solid var(--border); border-radius: 999px; font-size: .8rem; color: var(--muted); }
.fiche__top { display: grid; grid-template-columns: minmax(0, 150px) 1fr; gap: 1.25rem; align-items: end; margin-bottom: 1.5rem; }
@media (min-width: 640px) { .fiche__top { grid-template-columns: 200px 1fr; gap: 2rem; } }
.fiche__cover .cover { box-shadow: 0 4px 14px rgba(42, 33, 24, .3); }
.fiche__title { font-family: var(--font-title); font-weight: 700; font-size: clamp(1.7rem, 6vw, 2.6rem); line-height: 1.05; margin: 0 0 .3rem; overflow-wrap: break-word; }
.fiche__subtitle { font-family: var(--font-title); font-weight: 600; font-size: 1.2rem; line-height: 1.2; margin: 0 0 .5rem; color: var(--muted); }
.fiche__authors { margin: 0; font-weight: 600; color: var(--gold-text); }
.fiche__block { padding: 1rem 0; border-top: 1px solid var(--border); }
.fiche__h { font-family: var(--font-title); font-weight: 700; font-size: 1.3rem; margin: 0 0 .5rem; }
.fiche__text { margin: 0; line-height: 1.6; }
.facts { margin: 0; display: grid; gap: .4rem; }
.facts div { display: grid; grid-template-columns: 8.5rem 1fr; gap: .75rem; }
.facts dt { color: var(--muted); font-size: .9rem; }
.facts dd { margin: 0; }
.fiche__block + .fiche__block--quiet, .fiche__block--quiet { margin-top: .5rem; }
.fiche__h--quiet { font-family: var(--font-ui); font-weight: 600; font-size: .8rem; color: var(--muted); letter-spacing: .02em; }
.facts--quiet { font-size: .85rem; color: var(--muted); }
.facts--quiet dt { font-size: .85rem; }
.fiche__meta { margin-top: 1.5rem; }

.message-page { max-width: 560px; margin: 2rem auto; text-align: center; }

/* ---------- Administration (style neutre) ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--vellum); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table th { font-weight: 600; color: var(--muted); }

/* ---------- Petits écrans ---------- */
@media (max-width: 480px) {
  .topbar { padding-left: 1rem; padding-right: 1rem; }
  .topbar__logo { height: 24px; }
  .page { padding-left: 1rem; padding-right: 1rem; }
  .chips { margin-left: -1rem; margin-right: -1rem; padding-left: 1rem; padding-right: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
.facts + .fiche__text { margin-top: .6rem; }

/* ---------- Formulaire de fiche ---------- */
.book-form { max-width: 720px; margin: 0 auto; }
textarea {
  font: 1rem/1.5 var(--font-ui);
  width: 100%;
  padding: .7rem .85rem;
  color: var(--ink);
  background: var(--vellum);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
}
textarea:focus { border-color: var(--brand); outline: 2px solid var(--brand); outline-offset: 0; }
[aria-invalid="true"] { border-color: var(--accent); }
.field__error { font-size: .85rem; font-weight: 500; color: var(--accent); }
.field__label abbr { text-decoration: none; color: var(--accent); }
.group { display: grid; gap: 1rem; margin: 0; padding: 1rem 0 0; border: 0; border-top: 1px solid var(--border); }
.group legend { float: left; width: 100%; padding: 0; margin-bottom: .25rem; font-family: var(--font-title); font-weight: 700; font-size: 1.3rem; }
.group legend + * { clear: both; }
.group--quiet legend { font-family: var(--font-ui); font-weight: 600; font-size: .85rem; color: var(--muted); }
.row-2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 560px) { .row-2 { grid-template-columns: 1fr 1fr; } }
.form-actions { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: .75rem 0; background: linear-gradient(transparent, var(--paper) 30%); }

.cover-field { display: grid; grid-template-columns: 96px 1fr; gap: 1rem; align-items: start; }
.cover-field__preview .cover { width: 96px; }
.cover-field__actions { display: grid; gap: .5rem; justify-items: start; }
.cover--empty { display: flex; align-items: center; justify-content: center; padding: .5rem; background: var(--vellum); border: 1px dashed var(--border); box-shadow: none; color: var(--muted); font-size: .75rem; text-align: center; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.file-btn:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }

.fiche__actions { display: flex; flex-wrap: wrap; gap: .75rem; padding: 1rem 0 0; border-top: 1px solid var(--border); }
.fiche__actions form { margin: 0; }
.btn--danger { color: var(--accent); }
.btn--danger:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Scanner ---------- */
.scan { max-width: 560px; margin: 0 auto; }
.scan__stage {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background: #16130F;
  color: #EDE3D0;
}
.scan__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan__frame { position: absolute; left: 8%; right: 8%; top: 28%; bottom: 28%; pointer-events: none; }
.scan__frame span { position: absolute; width: 28px; height: 28px; border: 3px solid #D2AE5E; }
.scan__frame span:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; }
.scan__frame span:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; }
.scan__frame span:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; }
.scan__frame span:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; }
.scan__idle { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 1rem; text-align: center; }
.scan__idle p { margin: 0; }
.scan__idle .btn--primary { background: #D2AE5E; border-color: #D2AE5E; color: #16130F; }
.scan__status { margin: .75rem 0 0; min-height: 3em; font-size: .9rem; color: var(--muted); text-align: center; }
.scan__count { margin: 0 0 .5rem; text-align: center; font-weight: 600; color: var(--gold-text); }

.scan__sheet {
  margin: .5rem 0 1rem;
  padding: 1rem;
  background: var(--vellum);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.sheet__body[data-panel="found"] { display: grid; grid-template-columns: 76px 1fr; gap: .4rem 1rem; }
.sheet__body[data-panel="found"][hidden] { display: none; }
.sheet__cover { grid-row: span 1; }
.sheet__cover .cover { width: 76px; }
.sheet__title { margin: 0 0 .2rem; font-family: var(--font-title); font-weight: 700; font-size: 1.35rem; line-height: 1.15; }
.sheet__author { margin: 0; font-weight: 600; color: var(--gold-text); }
.sheet__meta { margin: .3rem 0 0; }
.sheet__actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.sheet__actions .btn--primary { flex: 1 1 100%; }
.sheet__actions .btn { flex: 1 1 auto; }

.scan__alt { display: grid; gap: .75rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.isbn-form { margin: 0; }
.isbn-form__row { display: flex; gap: .5rem; }
.isbn-form__row input { flex: 1; letter-spacing: .04em; }

/* ---------- Hors-ligne (phase 4) ---------- */
.queue-banner {
  margin: 0 0 1rem;
  padding: .7rem 1rem;
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  background: var(--vellum);
  font-size: .95rem;
}
.queue-banner p { margin: 0; }
.queue-banner p + p { margin-top: .35rem; }
.queue-banner a { font-weight: 600; color: var(--brand); }
.queue-banner--offline { border-style: dashed; }

.queue { margin: 1rem 0 0; padding: 1rem; border: 1px dashed var(--gold); border-radius: var(--radius); background: var(--vellum); }
.queue__title { margin: 0 0 .25rem; font-family: var(--font-title); font-size: 1.3rem; }
.queue__note { margin: 0 0 .5rem; color: var(--muted); }
.queue__note:empty { display: none; }
.queue__list { list-style: none; margin: 0; padding: 0; }
.queue__item { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; padding: .55rem 0; border-top: 1px solid var(--border); }
.queue__item:first-child { border-top: 0; }
.queue__isbn { font-variant-numeric: tabular-nums; letter-spacing: .03em; font-weight: 600; }
.queue__state { flex: 1 1 10rem; font-size: .9rem; color: var(--muted); }
.queue__item--introuvable .queue__state, .queue__item--erreur .queue__state { color: var(--accent); }
.queue__actions { display: flex; gap: .5rem; align-items: center; }
.queue__actions a, .queue__del {
  min-height: 44px; display: inline-flex; align-items: center; padding: 0 .75rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: transparent;
  font: inherit; font-size: .9rem; color: var(--ink); text-decoration: none; cursor: pointer;
}
.queue__actions a { border-color: var(--brand); color: var(--brand); font-weight: 600; }

/* ---------- Les autres bibliothèques, administration (phase 5) ---------- */
.badge { display: inline-block; padding: .1rem .55rem; border: 1px solid var(--gold); border-radius: 999px; font-size: .8rem; color: var(--gold-text); }
.library__export { color: var(--brand); font-weight: 600; }
.empty-note { padding: 1.5rem 1rem; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); }
.members__list { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .6rem; }
.member {
  display: flex; align-items: center; gap: 1rem; min-height: 64px; padding: .75rem 1rem;
  background: var(--vellum); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--ink); text-decoration: none;
}
.member:hover, .member:focus-visible { border-color: var(--gold); }
.member__initial {
  flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  background: var(--brand); color: var(--brand-ink); font-family: var(--font-title); font-weight: 700; font-size: 1.4rem;
}
.member__text { flex: 1; display: grid; gap: .1rem; min-width: 0; }
.member__name { font-family: var(--font-title); font-weight: 700; font-size: 1.25rem; line-height: 1.15; }
.member__meta { font-size: .9rem; color: var(--muted); }
.member__go { font-size: 1.6rem; color: var(--gold-text); }
.table__row--off td { color: var(--muted); }
.table__actions { display: flex; gap: .4rem; justify-content: flex-end; }
.admin--narrow { max-width: 640px; }
