/* Thème : blanc et bleu royal (#4169E1), toujours clair.
   Nuances : bleu nuit pour les titres, bleu pâle pour les fonds et en-têtes de tableaux. */
:root {
  --royal: #4169e1; --royal-fonce: #2f50c4; --royal-nuit: #1e3a8a; --royal-pale: #e8eefc; --royal-voile: #f4f7fe;
  --fond: #f5f7fd; --carte: #ffffff; --texte: #1c2440; --discret: #5a6584; --bord: #dce3f4;
  --accent: var(--royal); --accent-texte: #ffffff; --faux: #c0392b; --juste: #1e7f4f;
  --apprenti: #0f7b6c; --compagnon: #b26b00; --maitre: #a3243b; --marque: #ffe9a8;
  --ombre: 0 1px 3px rgba(30, 58, 138, .07);
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fond); color: var(--texte);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
main { max-width: 960px; margin: 0 auto; padding: 24px 16px 64px; }
main.large { max-width: 1280px; }
main.etroit { max-width: 440px; }
.centre { text-align: center; }
/* Titres : majuscules, tailles sobres et régulières (1,35 / 1,05 / 0,92 rem) */
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--royal-nuit); }
h1 { font-size: 1.35rem; line-height: 1.3; margin: .2em 0 .6em; }
h2 { font-size: 1.05rem; line-height: 1.35; margin: 1.8em 0 .7em; padding-bottom: .35em; border-bottom: 2px solid var(--royal-pale); }
.carte h2 { border-bottom: none; padding-bottom: 0; }
h3 { font-size: .92rem; line-height: 1.35; margin: 1.4em 0 .5em; }
.titre-accueil { font-size: 1.7rem; letter-spacing: .12em; margin-top: 2em; }


input, select, textarea, button, .bouton { font: inherit; color: inherit; }
input, select, textarea { background: var(--carte); border: 1px solid var(--bord); border-radius: 6px; padding: 6px 9px; max-width: 100%; }
textarea { width: 100%; }
button, .bouton { display: inline-block; background: var(--carte); border: 1px solid var(--bord); border-radius: 6px;
  padding: 6px 14px; cursor: pointer; text-decoration: none; color: var(--texte); }
button:hover, .bouton:hover { border-color: var(--accent); color: var(--royal-fonce); }
.principal:hover { background: var(--royal-fonce); border-color: var(--royal-fonce); color: #fff; }
.principal { background: var(--accent); color: var(--accent-texte); border-color: var(--accent); }
.danger { color: var(--faux); }
button.lien { background: none; border: none; padding: 0; color: var(--accent); }
button.lien.danger { color: var(--faux); }

.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: 10px; padding: 16px 20px; margin: 0 0 14px; box-shadow: var(--ombre); }
.formulaire label { display: block; margin: 0 0 12px; }
.formulaire label > input:not([type=checkbox]):not([type=radio]), .formulaire label > select { display: block; width: 100%; margin-top: 3px; }
.formulaire fieldset { border: none; padding: 0; margin: 0 0 12px; }
.formulaire legend { padding: 0; margin-bottom: 4px; }
.case { display: flex !important; gap: 8px; align-items: center; }
.choix-grade { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.choix-grade label { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.actions form { margin: 0; }
.filtres { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; }
.filtres input[type=search] { flex: 1; min-width: 200px; }
form.enligne { display: inline; }
progress { width: 100%; margin: 6px 0; }

.discret { color: var(--discret); }
.petit { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.alerte { border-left: 4px solid var(--faux); background: var(--carte); padding: 10px 14px; }
.succes { border-left: 4px solid var(--juste); background: var(--carte); padding: 10px 14px; }
.type { font-size: .75rem; border: 1px solid var(--bord); border-radius: 4px; padding: 0 6px; color: var(--discret); }

.grade { display: inline-block; font-size: .75rem; font-weight: 600; border-radius: 10px; padding: 1px 9px;
  border: 1px solid currentColor; white-space: nowrap; }
.g-Apprenti { color: var(--apprenti); }
.g-Compagnon { color: var(--compagnon); }
.g-Maître { color: var(--maitre); }

.liste { list-style: none; padding: 0; margin: 0; }
.article .entete, .entete-article { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; }
.article .titre { font: 600 .98rem Georgia, serif; text-transform: uppercase; letter-spacing: .04em; text-decoration: none; }
.article.lu .titre { color: var(--discret); }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin: 4px 0; }
.extrait { margin: 6px 0 0; color: var(--discret); font-size: .92rem; }
mark { background: var(--marque); color: inherit; padding: 0 1px; border-radius: 2px; }
.description { white-space: pre-wrap; margin: 10px 0; }

.lecteur { margin: 14px 0 24px; }
.lecteur iframe { width: 100%; height: 80vh; border: 1px solid var(--bord); border-radius: 8px; background: #fff; }
.lecteur audio { width: 100%; }
.lecteur video, .lecteur img { max-width: 100%; border-radius: 8px; }
pre.texte { white-space: pre-wrap; word-wrap: break-word; background: var(--carte); border: 1px solid var(--bord);
  border-radius: 8px; padding: 16px 20px; max-height: 80vh; overflow: auto; font: .95rem/1.6 Georgia, serif; }

.carte > h2:first-child { margin-top: 0; }
.commentaires h2 .compte { display: inline-block; font: 600 .85rem system-ui, sans-serif; background: var(--fond);
  border: 1px solid var(--bord); border-radius: 10px; padding: 0 8px; vertical-align: middle; color: var(--discret); }
.commentaire { padding: 14px 18px; margin: 0 0 12px; }
.entete-commentaire { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; }
.entete-commentaire .qui { flex: 1; min-width: 0; line-height: 1.35; }
.entete-commentaire form { margin: 0; }
.avatar { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border-radius: 50%; border: 2px solid currentColor; font: 700 .85rem system-ui, sans-serif; background: var(--fond); }
.commentaire .corps { white-space: pre-wrap; overflow-wrap: anywhere; padding-left: 50px; }
.nouveau-commentaire textarea { display: block; width: 100%; margin: 6px 0 10px; min-height: 96px; resize: vertical; }
.nouveau-commentaire textarea:focus, input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.pied-commentaire { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.compteur { margin-left: 6px; }
@media (max-width: 600px) { .commentaire .corps { padding-left: 0; } }

/* Boîte de confirmation (remplace la fenêtre du navigateur) */
dialog.confirmation { border: 1px solid var(--bord); border-radius: 12px; padding: 0; max-width: min(440px, calc(100vw - 32px));
  background: var(--carte); color: var(--texte); box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
dialog.confirmation::backdrop { background: rgba(20, 30, 70, .45); }
dialog.confirmation .contenu { padding: 22px 24px 8px; }
dialog.confirmation h3 { font-size: 1rem; margin: 0 0 8px; }
dialog.confirmation p { margin: 0; }
dialog.confirmation .boutons { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 20px; }
button.confirmer-danger { background: var(--faux); border-color: var(--faux); color: #fff; }

.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.chiffres .carte { margin: 0; }
.chiffres .n { display: block; font: 700 1.6rem Georgia, serif; }
.defile { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--carte); font-size: .92rem; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--bord); vertical-align: top; }
th { font-weight: 600; background: var(--royal-pale); color: var(--royal-nuit); }
td.nombre { text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 600px) {
  .barre .recherche { order: 3; flex-basis: 100%; }
  .entete-article { flex-direction: column; gap: 4px; }
}

/* Livres physiques : couvertures toutes au même format */
.choix-nature { display: flex; flex-wrap: wrap; gap: 6px 24px; }
.photos-couverture { display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); gap: 16px; margin: 4px 0 8px; }
.photo { display: block; cursor: pointer; margin: 0 !important; }
.photo .etiquette { display: block; margin-bottom: 4px; }
.cadre-photo { display: flex; align-items: center; justify-content: center; aspect-ratio: 2 / 3; width: 100%;
  border: 2px dashed var(--bord); border-radius: 8px; background: var(--fond); overflow: hidden; text-align: center; }
.photo:hover .cadre-photo, .photo:focus-within .cadre-photo { border-color: var(--accent); }
.cadre-photo img { width: 100%; height: 100%; object-fit: contain; }
.cadre-photo .invite { padding: 12px; color: var(--discret); font-size: .9rem; }
.photo input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.grille-livre { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; }
.couvertures { display: grid; grid-template-columns: repeat(2, minmax(0, 300px)); gap: 16px; margin: 14px 0 20px; }
.couvertures figure { margin: 0; }
.couvertures img, .cadre-image img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: contain;
  background: var(--carte); border: 1px solid var(--bord); border-radius: 8px; }
.cadre-image { max-width: 640px; }
.cadre-image img { aspect-ratio: auto; max-height: 75vh; }
.couvertures figcaption { text-align: center; font-size: .85rem; color: var(--discret); margin-top: 4px; }
.article.livre { display: flex; gap: 14px; align-items: flex-start; }
.article .corps-article { flex: 1; min-width: 0; }
.vignette { flex: none; display: block; width: 64px; }
.vignette img { display: block; width: 64px; height: 96px; object-fit: cover; border-radius: 4px; border: 1px solid var(--bord); background: var(--fond); }
.etat { font-size: .75rem; font-weight: 600; border-radius: 10px; padding: 1px 9px; }
.etat.disponible { background: color-mix(in srgb, var(--juste) 15%, transparent); color: var(--juste); }
.etat.emprunte { background: color-mix(in srgb, var(--compagnon) 18%, transparent); color: var(--compagnon); }
.retard { color: var(--faux); font-weight: 600; }
.pret.en-retard, .chiffres .en-retard { border-color: var(--faux); }
.ligne-retard td { background: color-mix(in srgb, var(--faux) 8%, transparent); }
.pret h3 { margin: 18px 0 8px; }
/* Prêt : l'emprunteur et la note ont toute la largeur */
.pret-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 16px; }
.pret-form .emprunteur, .pret-form .note { grid-column: 1 / -1; }
.pret-form .emprunteur select { font-size: 1.05rem; padding: 8px 10px; }
.pret-form .note textarea { display: block; width: 100%; margin-top: 3px; min-height: 90px; resize: vertical; }
.pret-form .boutons { grid-column: 1 / -1; }
.note-pret { white-space: pre-wrap; background: var(--fond); border-left: 3px solid var(--compagnon); border-radius: 4px; padding: 8px 12px; margin: 8px 0 12px; }
[hidden] { display: none !important; }
@media (max-width: 600px) {
  .photos-couverture, .couvertures { grid-template-columns: 1fr 1fr; gap: 10px; }
}
.choix-nature label.case { display: block !important; }
.choix-nature label.case input { margin: 0 6px 0 0; vertical-align: -1px; }
.note-tableau { white-space: pre-wrap; min-width: 180px; font-size: .88rem; }
.pret-form input[type=date] { max-width: 220px; }

/* Pagination */
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 14px 0 6px; }
.pagination .pg { display: inline-block; min-width: 36px; text-align: center; padding: 5px 10px; border: 1px solid var(--bord);
  border-radius: 6px; background: var(--carte); text-decoration: none; color: var(--royal); }
.pagination a.pg:hover { border-color: var(--royal); background: var(--royal-voile); }
.pagination .pg.actif { background: var(--royal); border-color: var(--royal); color: #fff; font-weight: 600; }
.pagination .pg.desactive { color: var(--bord); }
.pagination .pg.ellipse { border: none; background: none; min-width: 0; color: var(--discret); }
.pagination .pg-info { margin-left: auto; }
.article:hover { border-color: #c5d2f2; }
a:hover { color: var(--royal-fonce); }
.resultat { margin: 4px 0 8px; }
.resultat .effacer { margin-left: 8px; font-size: .88rem; }
.extrait-commentaire { border-left: 3px solid var(--royal-pale); padding-left: 8px; }

/* ===== Bandeau : logo · menu · recherche · moi, centré sur la largeur de la page ===== */
.barre { background: linear-gradient(90deg, var(--royal-nuit), var(--royal)); color: #fff; box-shadow: 0 2px 8px rgba(30, 58, 138, .18); position: relative; z-index: 10; }
.barre-interieur { max-width: 1200px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 10px 22px; }
.barre a, .barre summary, .barre button.lien { color: #fff; text-decoration: none; }
.barre .logo { font: 700 1rem Georgia, serif; text-transform: uppercase; letter-spacing: .12em; white-space: nowrap; }
.barre .menu { display: flex; align-items: center; gap: 4px 18px; }
.barre .menu > a, .barre summary { opacity: .92; white-space: nowrap; cursor: pointer; }
.barre .menu > a:hover, .barre summary:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
.barre a:focus-visible, .barre summary:focus-visible, .barre button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.barre .recherche { flex: 1; display: flex; max-width: 460px; margin: 0 auto; }
.barre .recherche input[type=search] { flex: 1; min-width: 0; border: none; border-radius: 6px 0 0 6px; padding: 7px 12px; background: rgba(255, 255, 255, .96); color: var(--texte); }
.barre .recherche .loupe { border: none; border-radius: 0 6px 6px 0; background: var(--royal-nuit); color: #fff; padding: 6px 12px; }
.barre .recherche .loupe:hover { background: #162c6b; color: #fff; }
/* Menus déroulants (Gestion, compte) */
.deroulant { position: relative; }
.deroulant summary { list-style: none; display: flex; align-items: center; gap: 8px; }
.deroulant summary::-webkit-details-marker { display: none; }
.deroulant summary::after { content: "▾"; font-size: .8em; opacity: .8; }
.sous-menu { position: absolute; top: calc(100% + 10px); left: 0; min-width: 210px; background: var(--carte); color: var(--texte);
  border: 1px solid var(--bord); border-radius: 10px; box-shadow: 0 10px 30px rgba(30, 58, 138, .18); padding: 6px; display: grid; }
.sous-menu.droite { left: auto; right: 0; }
.barre .sous-menu a, .barre .sous-menu button.lien { color: var(--texte); padding: 8px 12px; border-radius: 6px; text-align: left; opacity: 1; }
.barre .sous-menu a:hover, .barre .sous-menu button.lien:hover { background: var(--royal-pale); color: var(--royal-nuit); text-decoration: none; }
.sous-menu form { margin: 0; display: grid; border-top: 1px solid var(--bord); margin-top: 4px; padding-top: 4px; }
.qui-suis-je { padding: 8px 12px 10px; font-size: .85rem; color: var(--discret); border-bottom: 1px solid var(--bord); margin-bottom: 4px; }
.barre .moi summary { opacity: 1; }
.initiale { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%;
  background: #fff; font: 700 .85rem system-ui, sans-serif; text-transform: uppercase; }
@media (max-width: 760px) {
  .barre-interieur { flex-wrap: wrap; padding: 10px 16px; }
  .barre .moi { margin-left: auto; }
  .barre .recherche { order: 3; flex-basis: 100%; max-width: none; }
}
/* Demandes aux bibliothécaires */
.pastille { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: #e8833a; color: #fff;
  font: 700 .75rem/20px system-ui, sans-serif; text-align: center; }
.entete-demande { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin-bottom: 6px; }
.type-demande { font-size: .75rem; font-weight: 600; border-radius: 10px; padding: 1px 9px; background: var(--royal-pale); color: var(--royal-nuit); }
.type-demande.emprunt { background: color-mix(in srgb, var(--compagnon) 18%, transparent); color: var(--compagnon); }
.etat-demande { margin-left: auto; font-size: .85rem; font-weight: 600; color: var(--royal-nuit); }
.statut-ouverte .etat-demande { color: #c0661c; }
.statut-refusee .etat-demande { color: var(--faux); }
.statut-acceptee .etat-demande { color: var(--juste); }
.livre-demande { margin: 4px 0 8px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.message-demande { white-space: pre-wrap; background: var(--royal-voile); border-left: 3px solid var(--royal-pale); border-radius: 4px; padding: 8px 12px; margin: 6px 0 10px; }
.reponse-biblio { white-space: pre-wrap; background: color-mix(in srgb, var(--juste) 8%, transparent); border-left: 3px solid var(--juste); border-radius: 4px; padding: 8px 12px; margin: 6px 0 8px; }
.reponse-demande textarea, .demande-emprunt textarea { display: block; width: 100%; margin-top: 3px; }
.retour-demande { display: inline-flex !important; align-items: center; gap: 6px; margin: 0 !important; }
.ma-demande { background: var(--royal-voile); border: 1px solid var(--royal-pale); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
.ma-demande p { margin: 0 0 4px; }
.demande-emprunt { margin-top: 12px; border-top: 1px solid var(--bord); padding-top: 12px; }
