/* ============================================================
   Bibliothèque Universitaire INP-HB — Feuille de style principale
   Couleurs : vert #0B8A3B (institution) / orange #F28C1C (accent)
   ============================================================ */

:root {
  --green: #0b8a3b;
  --green-dark: #086b2e;
  --green-light: #e6f4ec;
  --orange: #f28c1c;
  --orange-dark: #d97706;
  --orange-light: #fff3e6;
  --red: #dc2626;
  --red-light: #fee2e2;
  --amber: #f59e0b;
  --amber-light: #fef3c7;
  --blue: #2563eb;
  --blue-light: #dbeafe;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.12);
  --sidebar-w: 260px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; color: var(--gray-900); }
h1 { font-size: 2rem; font-weight: 800; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1rem; }
.muted { color: var(--gray-500); }
.small { font-size: .85rem; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; } .wrap { flex-wrap: wrap; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .65rem 1.2rem; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: .95rem; cursor: pointer; transition: .18s;
  background: var(--green); color: #fff; font-family: inherit; line-height: 1.2;
  white-space: nowrap;
}
.btn:hover { background: var(--green-dark); text-decoration: none; transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-orange { background: var(--orange); }
.btn-orange:hover { background: var(--orange-dark); }
.btn-outline { background: transparent; color: var(--green); border-color: var(--green); }
.btn-outline:hover { background: var(--green-light); }
.btn-outline-white { background: transparent; color: #fff; border-color: rgba(255,255,255,.7); }
.btn-outline-white:hover { background: rgba(255,255,255,.15); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: var(--gray-100); color: var(--gray-700); }
.btn-ghost:hover { background: var(--gray-200); }
.btn-sm { padding: .4rem .8rem; font-size: .85rem; border-radius: 8px; }
.btn-lg { padding: .9rem 1.6rem; font-size: 1.05rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: .45rem .6rem; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .22rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
  white-space: nowrap;
}
.badge-green { background: var(--green-light); color: var(--green-dark); }
.badge-orange { background: var(--orange-light); color: var(--orange-dark); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-amber { background: var(--amber-light); color: #b45309; }
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* ---------- Cartes ---------- */
.card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.5rem; border: 1px solid var(--gray-100);
}
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.card-header h2, .card-header h3 { margin: 0; }

/* ---------- Formulaires ---------- */
.form-group { margin-bottom: 1rem; }
.form-group label, .label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .35rem; color: var(--gray-700); }
.required::after { content: " *"; color: var(--red); }
.form-control, input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: .65rem .85rem; border: 1px solid var(--gray-300); border-radius: 10px;
  font-family: inherit; font-size: .95rem; background: #fff; color: var(--gray-800); transition: .15s;
}
textarea { min-height: 90px; resize: vertical; }
.form-control:focus, input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(11,138,59,.15);
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.form-hint { font-size: .8rem; color: var(--gray-500); margin-top: .3rem; }
.form-section { margin-bottom: 1.75rem; }
.form-section-title {
  display: flex; align-items: center; gap: .6rem; font-size: 1.05rem; font-weight: 700;
  padding-bottom: .5rem; margin-bottom: 1rem; border-bottom: 2px solid var(--green-light); color: var(--green-dark);
}
.form-section-title i { color: var(--orange); }
.checkbox-label { display: flex; align-items: flex-start; gap: .6rem; font-weight: 500; cursor: pointer; }
.checkbox-label input { width: 18px; height: 18px; margin-top: .15rem; accent-color: var(--green); }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--gray-400); }
.input-icon input { padding-left: 2.4rem; }

/* ---------- Alertes ---------- */
.alert { padding: .9rem 1.1rem; border-radius: 10px; display: flex; gap: .75rem; align-items: flex-start; margin-bottom: 1rem; font-size: .93rem; }
.alert i { margin-top: .15rem; }
.alert-success { background: var(--green-light); color: var(--green-dark); border: 1px solid #b7e2c6; }
.alert-danger { background: var(--red-light); color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: var(--amber-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: var(--blue-light); color: #1e40af; border: 1px solid #bfdbfe; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--gray-200); }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; background: #fff; }
.table th, .table td { padding: .8rem .9rem; text-align: left; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.table th { background: var(--gray-50); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-600); }
.table tbody tr:hover { background: #fafcfb; }
.table tbody tr:last-child td { border-bottom: none; }
.table .actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ---------- Avatar ---------- */
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gray-200); background: var(--gray-100); flex-shrink: 0; }
.avatar-lg { width: 110px; height: 110px; border: 4px solid #fff; box-shadow: var(--shadow); }
.avatar-xl { width: 150px; height: 150px; }
.avatar-placeholder { display: flex; align-items: center; justify-content: center; color: var(--gray-400); font-size: 1.4rem; }

/* ---------- Navbar publique ---------- */
.navbar { background: #fff; border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 50; }
.navbar .container { display: flex; align-items: center; justify-content: space-between; height: 70px; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .75rem; font-weight: 800; color: var(--gray-900); font-size: 1.05rem; }
.brand img { width: 46px; height: 46px; border-radius: 50%; }
.brand small { display: block; font-weight: 500; color: var(--gray-500); font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; }
.nav-links { display: flex; gap: .25rem; align-items: center; list-style: none; margin: 0; padding: 0; }
.nav-links a { padding: .55rem .9rem; border-radius: 8px; color: var(--gray-700); font-weight: 500; }
.nav-links a:hover, .nav-links a.active { background: var(--green-light); color: var(--green-dark); text-decoration: none; }
.nav-toggle { display: none; background: none; border: none; font-size: 1.4rem; color: var(--gray-700); cursor: pointer; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 55%, #0fa64a 100%);
  color: #fff; padding: 4.5rem 0; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -120px; top: -120px; width: 480px; height: 480px;
  border-radius: 50%; border: 60px solid rgba(255,255,255,.07);
}
.hero::before {
  content: ""; position: absolute; left: -80px; bottom: -160px; width: 360px; height: 360px;
  border-radius: 50%; background: rgba(242,140,28,.18);
}
.hero .container { position: relative; z-index: 1; display: grid; grid-template-columns: 1.2fr .8fr; gap: 3rem; align-items: center; }
.hero h1 { color: #fff; font-size: 2.7rem; margin-bottom: 1rem; }
.hero h1 span { color: #ffd39b; }
.hero p { font-size: 1.1rem; opacity: .92; max-width: 560px; }
.hero-badge { display: inline-flex; align-items: center; gap: .5rem; background: rgba(255,255,255,.15); padding: .35rem .9rem; border-radius: 999px; font-size: .85rem; font-weight: 600; margin-bottom: 1rem; }
.hero-logo { display: flex; justify-content: center; }
.hero-logo img { width: 280px; height: 280px; border-radius: 50%; box-shadow: 0 20px 60px rgba(0,0,0,.25); background: #fff; }
.hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.5rem; }

.section { padding: 4rem 0; }
.section-title { text-align: center; margin-bottom: 2.5rem; }
.section-title h2 { font-size: 1.9rem; }
.section-title p { color: var(--gray-500); max-width: 620px; margin: .5rem auto 0; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; }
.feature { background: #fff; border-radius: var(--radius); padding: 1.75rem; box-shadow: var(--shadow); border-top: 4px solid var(--green); transition: .2s; }
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.feature:nth-child(even) { border-top-color: var(--orange); }
.feature-icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: var(--green); background: var(--green-light); margin-bottom: 1rem; }
.feature:nth-child(even) .feature-icon { color: var(--orange); background: var(--orange-light); }
.stats-band { background: #fff; border-top: 1px solid var(--gray-200); border-bottom: 1px solid var(--gray-200); }
.stats-band .container { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; padding: 2rem 1.25rem; text-align: center; }
.stats-band strong { display: block; font-size: 2rem; color: var(--green); font-weight: 800; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1.5rem; counter-reset: step; }
.step { position: relative; padding: 1.5rem 1.5rem 1.5rem 4.2rem; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.step::before { counter-increment: step; content: counter(step); position: absolute; left: 1.2rem; top: 1.3rem; width: 38px; height: 38px; border-radius: 50%; background: var(--orange); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; }

footer.footer { background: var(--gray-900); color: var(--gray-300); padding: 3rem 0 1.5rem; margin-top: auto; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.footer h4 { color: #fff; margin-bottom: .8rem; }
.footer a { color: var(--gray-300); display: block; padding: .2rem 0; }
.footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid var(--gray-700); padding-top: 1.2rem; font-size: .85rem; text-align: center; color: var(--gray-500); }

/* ---------- Page d'auth ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: linear-gradient(160deg, var(--green-dark), var(--green)); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.auth-side img { width: 120px; height: 120px; border-radius: 50%; background: #fff; margin-bottom: 1.5rem; }
.auth-side h2 { color: #fff; font-size: 2rem; }
.auth-side ul { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.auth-side li { padding: .4rem 0; display: flex; gap: .7rem; align-items: center; opacity: .95; }
.auth-side li i { color: #ffd39b; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; overflow-y: auto; }
.auth-form > div { width: 100%; max-width: 460px; }
.auth-form.wide > div { max-width: 860px; }

/* ---------- Layout tableau de bord ---------- */
.dash { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: #fff; border-right: 1px solid var(--gray-200);
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 60;
  transition: transform .25s;
}
.sidebar-brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--gray-100); }
.sidebar-brand img { width: 42px; height: 42px; border-radius: 50%; }
.sidebar-brand strong { display: block; font-size: .95rem; color: var(--gray-900); }
.sidebar-brand small { font-size: .7rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 1rem .75rem; }
.sidebar-nav .nav-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gray-400); font-weight: 700; padding: .9rem .75rem .4rem; }
.sidebar-nav a {
  display: flex; align-items: center; gap: .75rem; padding: .7rem .85rem; border-radius: 10px;
  color: var(--gray-600); font-weight: 500; font-size: .93rem; margin-bottom: .15rem; position: relative;
}
.sidebar-nav a i { width: 20px; text-align: center; color: var(--gray-400); }
.sidebar-nav a:hover { background: var(--gray-50); text-decoration: none; color: var(--gray-900); }
.sidebar-nav a.active { background: var(--green-light); color: var(--green-dark); font-weight: 600; }
.sidebar-nav a.active i { color: var(--green); }
.nav-count { margin-left: auto; background: var(--red); color: #fff; font-size: .7rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; min-width: 20px; text-align: center; }
.sidebar-user { border-top: 1px solid var(--gray-100); padding: 1rem 1.25rem; display: flex; align-items: center; gap: .75rem; }
.sidebar-user .name { font-weight: 600; font-size: .9rem; line-height: 1.2; }
.sidebar-user .role { font-size: .75rem; color: var(--gray-500); }
.sidebar-user .logout { margin-left: auto; color: var(--gray-400); font-size: 1.1rem; }
.sidebar-user .logout:hover { color: var(--red); }

.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: #fff; border-bottom: 1px solid var(--gray-200); padding: 0 1.75rem; height: 66px;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; position: sticky; top: 0; z-index: 40;
}
.topbar h1 { font-size: 1.25rem; margin: 0; }
.topbar .menu-btn { display: none; background: none; border: none; font-size: 1.3rem; color: var(--gray-700); cursor: pointer; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.notif-bell { position: relative; color: var(--gray-600); font-size: 1.2rem; }
.notif-bell .dot { position: absolute; top: -6px; right: -8px; background: var(--red); color: #fff; font-size: .65rem; font-weight: 700; padding: .05rem .4rem; border-radius: 999px; }
.content { padding: 1.75rem; flex: 1; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 55; }

/* ---------- Stat cards ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1.1rem; margin-bottom: 1.75rem; }
.stat { background: #fff; border-radius: var(--radius); padding: 1.2rem 1.3rem; box-shadow: var(--shadow); display: flex; align-items: center; gap: 1rem; border: 1px solid var(--gray-100); }
.stat-icon { width: 50px; height: 50px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.stat-value { font-size: 1.7rem; font-weight: 800; line-height: 1.1; color: var(--gray-900); }
.stat-label { font-size: .8rem; color: var(--gray-500); font-weight: 500; }
.bg-green { background: var(--green-light); color: var(--green); }
.bg-orange { background: var(--orange-light); color: var(--orange); }
.bg-red { background: var(--red-light); color: var(--red); }
.bg-blue { background: var(--blue-light); color: var(--blue); }
.bg-amber { background: var(--amber-light); color: #b45309; }
.bg-gray { background: var(--gray-100); color: var(--gray-600); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-sidebar { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }

/* ---------- Profil ---------- */
.profile-head { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.profile-head h2 { margin-bottom: .2rem; }
.info-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .9rem 1.5rem; margin: 0; }
.info-list div { border-bottom: 1px dashed var(--gray-200); padding-bottom: .5rem; }
.info-list dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); font-weight: 600; }
.info-list dd { margin: .15rem 0 0; font-weight: 500; color: var(--gray-900); word-break: break-word; }

/* ---------- Notifications ---------- */
.notif-list { display: flex; flex-direction: column; gap: .7rem; }
.notif { display: flex; gap: .9rem; padding: 1rem 1.1rem; background: #fff; border-radius: 10px; border: 1px solid var(--gray-200); border-left-width: 4px; align-items: flex-start; }
.notif.unread { background: #fbfdfc; }
.notif-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif .time { font-size: .75rem; color: var(--gray-400); }
.notif-rappel_j2 { border-left-color: var(--amber); }
.notif-rappel_j1 { border-left-color: var(--orange); }
.notif-retard { border-left-color: var(--red); }
.notif-info, .notif-compte { border-left-color: var(--blue); }
.notif-carte { border-left-color: var(--green); }

/* ---------- Deadline alert inline ---------- */
.deadline { font-size: .8rem; font-weight: 600; display: inline-flex; gap: .35rem; align-items: center; }
.deadline-ok { color: var(--green-dark); }
.deadline-warn { color: #b45309; }
.deadline-soon { color: var(--orange-dark); }
.deadline-late { color: var(--red); }

/* ---------- Catalogue ---------- */
.toolbar { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.25rem; }
.toolbar .input-icon { flex: 1; min-width: 220px; }
.toolbar select { width: auto; min-width: 170px; }
.books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.25rem; }
.book-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; transition: .2s; border: 1px solid var(--gray-100); }
.book-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.book-cover { height: 150px; background: linear-gradient(135deg, var(--green), #0fa64a); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 2.4rem; position: relative; }
.book-cover.c2 { background: linear-gradient(135deg, var(--orange), #f6a94a); }
.book-cover.c3 { background: linear-gradient(135deg, #1e3a8a, var(--blue)); }
.book-cover.c4 { background: linear-gradient(135deg, #6d28d9, #a78bfa); }
.book-cover.c5 { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.book-cover .cote { position: absolute; top: .6rem; left: .6rem; background: rgba(0,0,0,.35); font-size: .7rem; padding: .15rem .5rem; border-radius: 6px; font-weight: 600; }
.book-body { padding: 1rem 1.1rem 1.1rem; flex: 1; display: flex; flex-direction: column; gap: .3rem; }
.book-body h3 { font-size: 1rem; }
.book-body .auteur { color: var(--gray-500); font-size: .85rem; }
.book-foot { margin-top: auto; padding-top: .7rem; display: flex; justify-content: space-between; align-items: center; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(17,24,39,.55); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1rem; overflow-y: auto; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 640px; box-shadow: var(--shadow-lg); max-height: 92vh; display: flex; flex-direction: column; }
.modal-lg { max-width: 900px; }
.modal-head { padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; }
.modal-close { background: none; border: none; font-size: 1.3rem; color: var(--gray-400); cursor: pointer; }
.modal-close:hover { color: var(--gray-800); }
.modal-body { padding: 1.5rem; overflow-y: auto; }
.modal-foot { padding: 1rem 1.5rem; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: .7rem; flex-wrap: wrap; }

/* ---------- Toast ---------- */
#toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 200; display: flex; flex-direction: column; gap: .6rem; }
.toast { background: var(--gray-900); color: #fff; padding: .85rem 1.2rem; border-radius: 10px; box-shadow: var(--shadow-lg); display: flex; gap: .7rem; align-items: center; animation: slideIn .25s ease; max-width: 360px; font-size: .92rem; }
.toast.success { background: var(--green-dark); }
.toast.error { background: var(--red); }
.toast.warning { background: var(--orange-dark); }
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: .3rem; border-bottom: 2px solid var(--gray-200); margin-bottom: 1.25rem; overflow-x: auto; }
.tab { padding: .7rem 1.1rem; font-weight: 600; color: var(--gray-500); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; background: none; border-top: none; border-left: none; border-right: none; font-family: inherit; font-size: .93rem; }
.tab.active { color: var(--green-dark); border-bottom-color: var(--green); }

/* ---------- Photo upload ---------- */
.photo-upload { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.photo-preview { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; border: 3px dashed var(--gray-300); background: var(--gray-50); display: flex; align-items: center; justify-content: center; color: var(--gray-400); font-size: 2rem; overflow: hidden; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-preview.has-photo { border-style: solid; border-color: var(--green); }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 3rem 1rem; color: var(--gray-500); }
.empty i { font-size: 2.5rem; color: var(--gray-300); margin-bottom: .8rem; display: block; }

/* ---------- Progress ---------- */
.progress { height: 8px; background: var(--gray-200); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--green); border-radius: 999px; transition: width .3s; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: .3rem; justify-content: center; margin-top: 1.25rem; flex-wrap: wrap; }
.pagination button { padding: .45rem .8rem; border: 1px solid var(--gray-300); background: #fff; border-radius: 8px; cursor: pointer; font-family: inherit; font-weight: 600; color: var(--gray-700); }
.pagination button.active { background: var(--green); color: #fff; border-color: var(--green); }
.pagination button:disabled { opacity: .5; cursor: default; }

/* ============================================================
   CARTE DE BIBLIOTHÈQUE (format CR80 : 85.6 × 54 mm, ratio 1.586)
   ============================================================ */
.library-card {
  width: 500px; height: 315px; border-radius: 16px; overflow: hidden; position: relative;
  background: #fff; box-shadow: 0 12px 40px rgba(0,0,0,.18); font-family: 'Inter', sans-serif; color: var(--gray-900);
  border: 1px solid var(--gray-200); margin: 0 auto;
}
.library-card .lc-head {
  height: 62px; background: linear-gradient(90deg, var(--green-dark), var(--green) 65%, var(--orange));
  display: flex; align-items: center; gap: .7rem; padding: 0 1rem; color: #fff;
}
.library-card .lc-head img { width: 46px; height: 46px; border-radius: 50%; background: #fff; padding: 1px; }
.library-card .lc-head .t1 { font-weight: 800; font-size: .95rem; letter-spacing: .02em; line-height: 1.15; }
.library-card .lc-head .t2 { font-size: .68rem; opacity: .95; text-transform: uppercase; letter-spacing: .08em; }
.library-card .lc-head .lc-lib { margin-left: auto; text-align: right; }
.library-card .lc-head .lc-lib .t1 { font-size: .8rem; }
.library-card .lc-head .lc-lib i { font-size: 1.4rem; }
.library-card .lc-body { display: flex; gap: 1rem; padding: .9rem 1rem .6rem; }
.library-card .lc-photo { width: 100px; height: 120px; border-radius: 8px; object-fit: cover; border: 2px solid var(--green); background: var(--gray-100); flex-shrink: 0; }
.library-card .lc-info { flex: 1; font-size: .72rem; display: grid; grid-template-columns: 1fr 1fr; gap: .25rem .6rem; align-content: start; }
.library-card .lc-info .full { grid-column: 1 / -1; }
.library-card .lc-info label { display: block; font-size: .58rem; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-500); font-weight: 600; }
.library-card .lc-info span { font-weight: 700; color: var(--gray-900); display: block; line-height: 1.2; }
.library-card .lc-name { font-size: .95rem !important; color: var(--green-dark) !important; }
.library-card .lc-qr { width: 88px; height: 88px; flex-shrink: 0; background: #fff; padding: 3px; border: 1px solid var(--gray-200); border-radius: 6px; }
.library-card .lc-qr canvas, .library-card .lc-qr img { width: 100% !important; height: 100% !important; }
.library-card .lc-foot {
  position: absolute; bottom: 0; left: 0; right: 0; height: 46px; background: var(--gray-50); border-top: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between; padding: 0 1rem; font-size: .65rem;
}
.library-card .lc-number { font-family: 'Courier New', monospace; font-weight: 800; font-size: .95rem; letter-spacing: .1em; color: var(--gray-900); }
.library-card .lc-stamp { display: flex; align-items: center; gap: .5rem; color: var(--green-dark); font-weight: 700; }
.library-card .lc-stamp .seal { width: 34px; height: 34px; border: 2px solid var(--green); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .55rem; text-align: center; line-height: 1; color: var(--green); transform: rotate(-12deg); opacity: .85; }
.library-card .lc-sign { font-family: 'Brush Script MT', 'Segoe Script', cursive; font-size: 1rem; color: var(--gray-700); border-bottom: 1px solid var(--gray-400); padding: 0 .5rem; }
.library-card .lc-stripe { position: absolute; top: 62px; left: 0; right: 0; height: 4px; background: repeating-linear-gradient(90deg, var(--orange) 0 20px, #fff 20px 24px, var(--green) 24px 44px, #fff 44px 48px); }
.library-card .lc-watermark { position: absolute; right: -30px; bottom: 20px; width: 200px; height: 200px; opacity: .06; pointer-events: none; }

/* Verso */
.library-card.lc-back { background: #fff; }
.library-card.lc-back .lc-back-body { padding: 1rem 1.2rem; font-size: .7rem; height: calc(100% - 46px); }
.library-card.lc-back h4 { font-size: .8rem; color: var(--green-dark); margin-bottom: .4rem; text-transform: uppercase; letter-spacing: .05em; }
.library-card.lc-back ol { margin: 0; padding-left: 1rem; }
.library-card.lc-back li { margin-bottom: .2rem; }

@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; left: 0; top: 0; width: 100%; display: flex; flex-direction: column; gap: 10mm; align-items: center; padding: 10mm; }
  .library-card { box-shadow: none; border: 1px solid #999; page-break-inside: avoid; }
  .no-print { display: none !important; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-sidebar { grid-template-columns: 1fr; }
  .hero .container { grid-template-columns: 1fr; text-align: center; }
  .hero p { margin: 0 auto; }
  .hero-actions { justify-content: center; }
  .hero-logo img { width: 200px; height: 200px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .sidebar-overlay.show { display: block; }
  .main { margin-left: 0; }
  .topbar .menu-btn { display: inline-block; }
  .topbar { padding: 0 1rem; }
  .content { padding: 1.1rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-side { padding: 2rem 1.5rem; }
  .auth-side ul { display: none; }
  .auth-side img { width: 80px; height: 80px; margin-bottom: .8rem; }
  .auth-side h2 { font-size: 1.4rem; }
  .nav-toggle { display: inline-block; }
  .nav-links { display: none; position: absolute; top: 70px; left: 0; right: 0; background: #fff; flex-direction: column; align-items: stretch; padding: .75rem; border-bottom: 1px solid var(--gray-200); box-shadow: var(--shadow-lg); }
  .nav-links.open { display: flex; }
  .hero { padding: 3rem 0; }
  .hero h1 { font-size: 2rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .library-card { transform-origin: top left; }
  .card-scale { width: 100%; overflow-x: auto; padding-bottom: .5rem; }
  .card-scale .library-card { margin: 0; }
}
@media (max-width: 480px) {
  .brand span.title { display: none; }
  .stat-value { font-size: 1.4rem; }
  .content { padding: .9rem; }
  .card { padding: 1.1rem; }
  .btn { padding: .6rem .95rem; font-size: .9rem; }
}
