/* ==========================================================================
   BiblioClub · Feuille de style principale
   Ambiance chaleureuse de bibliothèque familiale, haute lisibilité, mobile-first
   ========================================================================== */

:root {
  color-scheme: light dark;

  /* Palette claire : papier crème, reliure bleu sarcelle, or chaud */
  --bg-page: #f5f3ec;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #fcfbfa;
  --bg-subtle: #eae6dc;
  --border-color: #dcd6c8;
  --border-focus: #1a4c5a;

  --text-main: #192126;
  --text-muted: #57656f;
  --text-invert: #ffffff;

  --color-primary: #1a4c5a;
  --color-primary-hover: #123640;
  --color-primary-light: #e4eef1;

  --color-accent: #c98d26;
  --color-accent-hover: #aa741b;
  --color-accent-light: #fdf6e9;

  --color-success: #22794a;
  --color-success-light: #e6f4ec;
  --color-warning: #bd6a14;
  --color-warning-light: #fef1e3;
  --color-danger: #b32a22;
  --color-danger-light: #fbeae9;
  --color-info: #0284c7;
  --color-info-light: #e0f2fe;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.05);

  --font-serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg-page: #0f1518;
  --bg-surface: #182126;
  --bg-surface-elevated: #1f2a30;
  --bg-subtle: #243138;
  --border-color: #2b3941;
  --border-focus: #3b889e;

  --text-main: #eef2f5;
  --text-muted: #97a7b2;
  --text-invert: #0f1518;

  --color-primary: #3b889e;
  --color-primary-hover: #4ea0b7;
  --color-primary-light: #162a31;

  --color-accent: #dfa640;
  --color-accent-hover: #f1b953;
  --color-accent-light: #2c2517;

  --color-success: #38a169;
  --color-success-light: #152d21;
  --color-warning: #dd6b20;
  --color-warning-light: #322116;
  --color-danger: #e53e3e;
  --color-danger-light: #351717;
  --color-info: #38bdf8;
  --color-info-light: #0c2838;

  --color-accent-hover: #f1ba55;
  --color-accent-light: #322511;

  --color-success: #38a568;
  --color-success-light: #132d1e;
  --color-warning: #df8428;
  --color-warning-light: #332010;
  --color-danger: #d94b42;
  --color-danger-light: #331513;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
}

/* ================= RESET ET BASE ================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-main);
}

p.lead {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* ================= EN-TÊTE ================= */
.biblio-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.biblio-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.biblio-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.biblio-logo {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.biblio-title {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--color-primary);
}

.biblio-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: block;
}

.biblio-header__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: var(--bg-subtle);
  color: var(--text-main);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.icon-btn:hover {
  background: var(--border-color);
  transform: scale(1.05);
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem;
  background: var(--color-success-light);
  color: var(--color-success);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-success);
}

.sync-badge.syncing .sync-dot {
  background-color: var(--color-warning);
  animation: pulse 1s infinite alternate;
}

/* Serveur injoignable : rien ne peut être enregistré, ça doit se voir. */
.sync-badge.error {
  background: var(--color-danger-light) !important;
  color: var(--color-danger);
}

.sync-badge.error .sync-dot {
  background-color: var(--color-danger);
}

.btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

#rescue-banner {
  margin: 0 0 1rem;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.user-pill:hover {
  background: var(--border-color);
}

.logout-btn {
  text-decoration: none;
  font-size: 1.15rem;
  cursor: pointer;
}

.logout-btn:hover {
  background: rgba(231, 111, 81, 0.2);
  transform: scale(1.08);
}

/* ================= NAVIGATION ================= */
.biblio-nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.biblio-nav::-webkit-scrollbar {
  display: none;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: var(--color-primary);
}

.nav-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.nav-tab__icon {
  font-size: 1.15rem;
}

.nav-tab__badge {
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

.nav-tab.active .nav-tab__badge {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

/* ================= CONTENU PRINCIPAL ================= */
.biblio-main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

/* ================= CARTES & CONTENEURS ================= */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.5rem;
}

.card--spotlight {
  border-color: var(--color-accent);
  background: linear-gradient(to bottom, var(--bg-surface-elevated), var(--bg-surface));
}

/* ================= BOUTONS ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  min-height: 44px;
  transition: all 0.15s ease;
  user-select: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--color-primary);
  color: #ffffff;
}

.btn--primary:hover {
  background: var(--color-primary-hover);
}

.btn--secondary {
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn--secondary:hover {
  background: var(--border-color);
}

.btn--accent {
  background: var(--color-accent);
  color: #ffffff;
}

.btn--accent:hover {
  background: var(--color-accent-hover);
}

.btn--danger {
  background: var(--color-danger);
  color: #ffffff;
}

.btn--outline {
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn--outline:hover {
  background: var(--bg-subtle);
}

.btn--large {
  padding: 0.85rem 1.5rem;
  font-size: 1.05rem;
  border-radius: var(--radius-lg);
}

.btn--small {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  min-height: 36px;
}

.btn--chip {
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  border-radius: var(--radius-full);
}

.btn--chip.active {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
}

/* ================= 1. COMPTOIR DE PRÊT ================= */
.comptoir-hero {
  background: linear-gradient(135deg, var(--color-primary-light), var(--bg-surface));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.comptoir-quick-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.comptoir-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 860px) {
  .comptoir-grid {
    grid-template-columns: 3fr 2fr;
  }
}

.loans-list, .reservations-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.loan-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  gap: 1rem;
}

.loan-item__left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.loan-item__cover {
  width: 44px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: var(--shadow-sm);
  background: var(--bg-subtle);
}

.loan-item__info h4 {
  font-size: 1rem;
  font-family: var(--font-sans);
  margin-bottom: 0.2rem;
}

.loan-item__borrower {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.loan-item__due {
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.loan-item__due.status--overdue {
  color: var(--color-danger);
}

.loan-item__due.status--soon {
  color: var(--color-warning);
}

.loan-item__due.status--ok {
  color: var(--color-success);
}

/* ================= 2. CATALOGUE ================= */
.catalogue-toolbar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.4rem 1rem;
  gap: 0.5rem;
}

.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-main);
  outline: none;
  font-size: 1rem;
  padding: 0.4rem 0;
}

.search-box__clear {
  color: var(--text-muted);
  font-size: 1.2rem;
  padding: 0.2rem 0.5rem;
}

.filters-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filters-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 48px;
}

.filters-chips {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
  scrollbar-width: none;
}

.chip {
  padding: 0.35rem 0.85rem;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  transition: all 0.15s ease;
}

.chip:hover {
  border-color: var(--color-primary);
}

.chip.active {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
}

.filters-row--secondary {
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
}

.filters-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.select-pill {
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
}

.results-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Grille de livres */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1.5rem;
}

@media (min-width: 600px) {
  .books-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

.book-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.book-card__cover-wrapper {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--bg-subtle);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-card__cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-card__placeholder {
  font-size: 3rem;
  opacity: 0.6;
}

.book-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.book-badge--new {
  background: var(--color-accent);
  color: #ffffff;
}

.book-badge--special {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #ffffff;
  top: 8px;
  left: 8px;
  right: auto;
}

.book-badge--unverified {
  background: #d97706;
  color: #ffffff;
  bottom: 8px;
  left: 8px;
  top: auto;
  right: auto;
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
}

.chip--special {
  border-color: #d97706 !important;
  color: #b45309 !important;
  font-weight: 600;
}

.chip--special.active {
  background: linear-gradient(135deg, #d97706, #b45309) !important;
  color: #ffffff !important;
}

.special-edition-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  border: 1px solid #f59e0b;
}

[data-theme="dark"] .special-edition-banner {
  background: #451a03;
  color: #fef3c7;
  border-color: #b45309;
}


.book-card__content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.book-card__title {
  font-size: 1rem;
  font-family: var(--font-sans);
  font-weight: 700;
  margin-bottom: 0.25rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-card__authors {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.book-card__tags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: auto;
  margin-bottom: 0.75rem;
}

.tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 600;
}

.book-card__stock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 600;
}

.stock-pill {
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

.stock-pill--ok {
  background: var(--color-success-light);
  color: var(--color-success);
}

.stock-pill--empty {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

/* ================= 3. LES ADHÉRENTS ================= */
.adherents-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.member-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.member-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.member-card__stripe {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
}

.member-card__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.member-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #ffffff;
  font-weight: bold;
  box-shadow: var(--shadow-sm);
}

.member-info h3 {
  font-size: 1.2rem;
  margin-bottom: 0.15rem;
}

.member-nickname {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

.member-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: var(--bg-page);
  border-radius: var(--radius-md);
  margin-top: auto;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ================= 4. SCANNER & AJOUT DE LIVRE ================= */
.scanner-container {
  max-width: 860px;
  margin: 0 auto;
}

.scanner-header {
  margin-bottom: 1.5rem;
}

.scan-methods-card {
  margin-bottom: 2rem;
}

.scan-methods-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.camera-viewport {
  position: relative;
  width: 100%;
  max-width: 520px;
  height: 340px;
  margin: 1.5rem auto;
  background: #000000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

#camera-reader-box {
  width: 100%;
  height: 100%;
}

.camera-target-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 240px;
  height: 140px;
  border: 3px dashed rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-md);
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
}

.camera-stop-btn {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

.camera-tip {
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  text-align: center;
  color: #ffffff;
  font-size: 0.85rem;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.isbn-manual-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.or-separator {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.input-with-button {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  min-width: 280px;
}

.input-with-button input {
  flex: 1;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-main);
}

.feedback-banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-top: 1rem;
  font-weight: 500;
  font-size: 0.9rem;
}

.feedback-banner.success {
  background: var(--color-success-light);
  color: var(--color-success);
}

.feedback-banner.error {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

.feedback-banner.info {
  background: var(--color-info-light);
  color: var(--color-info);
}

.feedback-banner.warning {
  background: var(--color-warning-light);
  color: var(--color-warning);
}



.book-form-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-top: 1.5rem;
}

@media (min-width: 700px) {
  .book-form-layout {
    grid-template-columns: 220px 1fr;
  }
}

.book-preview-card {
  width: 100%;
  aspect-ratio: 2 / 3;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg-page);
  margin-bottom: 1rem;
}

.book-preview-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-cover-placeholder {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.book-cover-placeholder span {
  font-size: 3rem;
  display: block;
}

.photo-capture-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input, .form-group select, .form-group textarea {
  padding: 0.65rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-main);
  outline: none;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--border-focus);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 500px) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
}

.stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  width: fit-content;
}

.stepper__btn {
  padding: 0.5rem 1rem;
  background: var(--bg-subtle);
  color: var(--text-main);
  font-weight: bold;
  font-size: 1.1rem;
}

.stepper__input {
  width: 50px;
  text-align: center;
  border: none;
  background: var(--bg-surface);
  color: var(--text-main);
  font-weight: 600;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* ================= 5. LE REGISTRE / STATS ================= */
.stats-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.stat-card__icon {
  font-size: 2.5rem;
}

.stat-card__number {
  font-size: 2rem;
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--color-primary);
  display: block;
  line-height: 1;
}

.stat-card__label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.registre-details-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 800px) {
  .registre-details-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
}

/* ================= MODALES ================= */
.biblio-modal {
  margin: auto;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: var(--shadow-lg);
  max-width: 520px;
  width: 90%;
  padding: 0;
  animation: modalScale 0.2s ease-out;
}

.biblio-modal--large {
  max-width: 720px;
}

.biblio-modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.biblio-modal__content {
  display: flex;
  flex-direction: column;
  max-height: 85dvh;
}

.biblio-modal__header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.close-modal-btn {
  font-size: 1.5rem;
  color: var(--text-muted);
  line-height: 1;
  padding: 0.25rem 0.5rem;
}

.biblio-modal__body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.biblio-modal__footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

.select-full {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-page);
  color: var(--text-main);
}

.duration-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.due-preview {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
}

.color-palette {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.color-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  transition: transform 0.15s ease;
}

.color-dot.active {
  border-color: var(--text-main);
  transform: scale(1.15);
}

/* ================= TOAST ================= */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--color-primary);
  color: #ffffff;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  z-index: 1000;
  /* Le toast passe au-dessus du bouton « Enregistrer » sur téléphone : il ne
     doit jamais intercepter le doigt qui vise ce bouton. */
  pointer-events: none;
  animation: toastSlide 0.25s ease-out;
}

@keyframes toastSlide {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================= STYLES LECTEUR & RÉSERVATIONS ================= */
.reader-welcome-banner {
  background: linear-gradient(135deg, var(--color-primary-light), var(--bg-surface));
  border: 1px solid var(--border-color);
  border-left: 6px solid var(--color-accent);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.reader-welcome-banner__content {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.reader-welcome-banner__icon {
  font-size: 2.25rem;
  flex-shrink: 0;
}

.reader-welcome-banner h3 {
  font-size: 1.25rem;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}

.reader-welcome-banner p {
  color: var(--text-main);
  font-size: 0.95rem;
}

.btn--reserve {
  background: var(--color-accent);
  color: #ffffff;
  border: none;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.btn--reserve:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}

.reservation-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  margin-bottom: 0.65rem;
  gap: 0.75rem;
}

.reservation-item__info h4 {
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.reservation-item__info p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.reservation-item__actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* ================= RESPONSIVE PETITS ÉCRANS ================= */
@media (max-width: 600px) {
  .biblio-title {
    font-size: 1.25rem;
  }
  .biblio-subtitle {
    display: none;
  }
  .comptoir-hero {
    padding: 1.25rem;
  }
  .comptoir-quick-actions {
    width: 100%;
  }
  .comptoir-quick-actions .btn {
    flex: 1;
  }
}

/* Recherche par titre : propositions à choisir (la première notice venue
   n'est jamais prise d'office). */
.title-results {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.6rem;
  max-height: 46vh;
  overflow-y: auto;
}

.title-results__hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.title-candidate {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-main);
  cursor: pointer;
  font: inherit;
}

.title-candidate:hover,
.title-candidate:focus-visible {
  border-color: var(--color-primary);
}

.title-candidate__meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}
