:root { --topbar-h: 3.3rem; --menu-w: 12.5rem; --menu-w-reduit: 3.6rem; --accent: #2b5d8a; --border: #d4d4d8; --danger: #b3261e; --success: #2e7d32; }
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, sans-serif; line-height: 1.5; color: #1f2933; background: #f7f7f8; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; padding: 0 1.5rem; background: var(--accent); }
.topbar a { color: #fff; text-decoration: none; }
.brand { font-weight: 700; font-size: 1.2rem; }

/* Disposition : menu latéral fixe à gauche, contenu à droite aligné à gauche */
.layout { display: flex; align-items: flex-start; }
.sidebar {
    position: sticky; top: var(--topbar-h); flex: none; width: var(--menu-w);
    height: calc(100vh - var(--topbar-h)); overflow-y: auto; padding: .5rem 0;
    background: #dbeafe; border-right: 1px solid #b6d0f0;
}
.sidebar nav { display: flex; flex-direction: column; }
.sidebar a, .sidebar-toggle {
    display: flex; align-items: center; gap: .75rem; width: 100%; padding: .65rem 1rem;
    color: #1f2933; text-decoration: none; font: inherit; text-align: left;
}
.sidebar a:hover, .sidebar-toggle:hover { background: #c7dcf7; }
.sidebar a.actif { background: #fff; color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-toggle { border: 0; border-radius: 0; background: transparent; color: #475569; cursor: pointer; margin-bottom: .25rem; }
.sidebar-toggle:hover { color: var(--accent); }
.sidebar-icone, .sidebar-toggle-icone { flex: none; width: 1.5rem; text-align: center; }
html[data-menu="reduit"] .sidebar { width: var(--menu-w-reduit); }
html[data-menu="reduit"] .sidebar-libelle { display: none; }
html[data-menu="reduit"] .sidebar a, html[data-menu="reduit"] .sidebar-toggle { padding-left: 0; padding-right: 0; justify-content: center; }
main { flex: 1; min-width: 0; overflow-x: auto; max-width: 90rem; margin: 1.5rem 0; padding: 0 1.5rem; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { vertical-align: middle; padding: .5rem .75rem; border-bottom: 1px solid var(--border); text-align: left; }
.search { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
input, textarea, select, button, .button { font: inherit; padding: .4rem .6rem; border: 1px solid var(--border); border-radius: 4px; }
button, .button { white-space: nowrap; background: var(--accent); color: #fff; border-color: var(--accent); cursor: pointer; text-decoration: none; }
button.danger, .button.danger { background: var(--danger); border-color: var(--danger); }
button.success, .button.success { background: var(--success); border-color: var(--success); }
/* Cellule d'actions : reste une vraie cellule de tableau (hauteur de la ligne, bordure continue) */
td.actions { white-space: nowrap; }
.actions > * { display: inline-block; vertical-align: middle; margin: 0 .35rem 0 0; }
.actions > *:last-child { margin-right: 0; }
.actions form { margin: 0 .35rem 0 0; }
.form label { display: block; margin-top: 1rem; }
.form input, .form textarea { display: block; width: 100%; max-width: 32rem; margin-top: .25rem; }
.error { color: var(--danger); font-size: .9rem; }
.flash { padding: .6rem 1rem; border-radius: 4px; }
.flash-success { background: #e3f4e6; }
.flash-error { background: #fbe4e2; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; }
dt { font-weight: 600; }
dd { margin: 0; }

/* Sélecteur d'auteurs */
.picker-group { border: 0; padding: 0; margin: 1rem 0 0; max-width: 32rem; }
.picker-group legend { padding: 0; }
.picker-group [data-auteur-picker] { position: relative; }
.picker-selected { list-style: none; margin: .25rem 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.picker-selected li { display: inline-flex; align-items: center; gap: .4rem; padding: .15rem .3rem .15rem .6rem; background: #e6eef5; border: 1px solid var(--border); border-radius: 999px; }
.picker-remove { padding: 0 .45rem; line-height: 1.4; background: transparent; color: var(--danger); border: 0; font-size: 1.1rem; }
.picker-input { width: 100%; }
.picker-results { position: absolute; z-index: 10; left: 0; right: 0; margin: 0; padding: 0; list-style: none; background: #fff; border: 1px solid var(--border); border-radius: 4px; max-height: 16rem; overflow-y: auto; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.picker-results[hidden] { display: none; }
.picker-results li { padding: .4rem .6rem; cursor: pointer; }
.picker-results li.active { background: #e6eef5; }
.picker-results li.picker-empty { color: #6b7280; cursor: default; }
small { display: block; color: #6b7280; margin-top: .25rem; }

/* Couvertures */
.cover-group { border: 0; padding: 0; margin: 1rem 0 0; max-width: 32rem; }
.cover-group legend { padding: 0; }
.cover { display: block; max-width: 14rem; max-height: 20rem; margin: .5rem 0; border: 1px solid var(--border); border-radius: 4px; background: #fff; }
.thumb-cell { width: 3.5rem; }
.thumb { display: block; height: 3.5rem; width: auto; max-width: 3.5rem; object-fit: cover; border-radius: 3px; }
.form input[type="checkbox"] { display: inline; width: auto; margin: 0 .4rem 0 0; }

/* Bandes dessinées */
.compteur { color: #6b7280; margin: .25rem 0 .75rem; }
.filtre { background: #e6eef5; padding: .4rem .75rem; border-radius: 4px; }
.pager { display: flex; gap: .5rem; align-items: center; justify-content: center; margin: 1rem 0; }
.auteurs-group { max-width: 44rem; }
.auteur-row { display: flex; gap: .5rem; align-items: flex-start; flex-wrap: wrap; margin: .5rem 0; padding: .5rem; background: #fff; border: 1px solid var(--border); border-radius: 4px; }
.auteur-row-champ { flex: 1 1 14rem; min-width: 12rem; }
.row-remove { background: transparent; color: var(--danger); border-color: var(--danger); }
#auteur-row-add { margin: .25rem 0; background: #fff; color: var(--accent); }
.images-group { border: 0; padding: 0; margin: 1.5rem 0 0; max-width: 44rem; }
.images-group legend { padding: 0; font-weight: 600; }
.img-card { display: flex; gap: 1rem; margin: .75rem 0; padding: .75rem; background: #fff; border: 1px solid var(--border); border-radius: 4px; }
.img-fields { flex: 1; min-width: 0; }
.img-type { margin-top: .75rem; }
.img-type > span { display: block; }
.thumb-lg { display: block; max-width: 7rem; max-height: 10rem; height: auto; border-radius: 3px; border: 1px solid var(--border); }
.form input[type="radio"] { display: inline; width: auto; margin: 0 .4rem 0 0; }
label.inline { display: block; margin-top: .5rem; }
.bd-fiche { display: flex; gap: 2rem; align-items: flex-start; flex-wrap: wrap; }
.bd-images { flex: 0 1 18rem; }
.bd-principale { margin: 0; }
.bd-principale figcaption, .bd-galerie figcaption { color: #6b7280; font-size: .85rem; }
.bd-galerie { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .75rem; }
.bd-galerie figure { margin: 0; max-width: 7rem; }

/* Autres images d'une BD */
.image-row { display: flex; gap: .75rem; align-items: flex-start; flex-wrap: wrap; margin: .5rem 0; padding: .5rem; background: #fff; border: 1px solid var(--border); border-radius: 4px; }
.image-row-champ { flex: 1 1 12rem; min-width: 10rem; }
.image-multi { display: block; margin: .75rem 0 .5rem; }
#image-row-add { margin: .25rem 0; background: #fff; color: var(--accent); }

/* Image par défaut des BD sans couverture (SVG sans dimensions propres : on les fixe) */
.thumb-defaut { width: 2.5rem; height: 3.5rem; object-fit: contain; }
.cover-defaut { width: 10rem; height: auto; opacity: .9; }

/* Boutons de fin de formulaire (Enregistrer / Annuler) : même hauteur, côte à côte */

/* Gestion des listes (styles, lieux) */
.onglets { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.onglets a { padding: .4rem .8rem; border: 1px solid var(--border); border-radius: 4px; background: #fff; text-decoration: none; }
.onglets a.actif { background: var(--accent); border-color: var(--accent); color: #fff; }
.inline-rename { display: flex; gap: .5rem; margin: 0; }
.inline-rename input[type="text"] { flex: 1; min-width: 8rem; }
button:disabled { opacity: .45; cursor: not-allowed; }

.inline-rename input.ordre { flex: 0 0 5rem; min-width: 0; width: 5rem; }
.aide { color: #6b7280; font-size: .9rem; }

/* Choix oui/non : un seul interrupteur qui bascule à gauche (non) ou à droite (oui) */
.choix-group { margin: 1rem 0 0; }
.choix-titre { display: block; }
.form .switch-field { display: inline-flex; align-items: center; gap: .6rem; margin-top: .4rem; cursor: pointer; }
.switch-field .switch-off { order: 1; }
.switch-field input[type="checkbox"] { order: 2; }
.switch-field .switch-on { order: 3; }
.switch-field input[type="checkbox"] {
    appearance: none; -webkit-appearance: none; flex: none; margin: 0; padding: 0;
    width: 3rem; height: 1.6rem; border: 1px solid var(--border); border-radius: 999px;
    background: #9ca3af; position: relative; cursor: pointer; transition: background .15s;
}
.switch-field input[type="checkbox"]::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: calc(1.6rem - 6px); height: calc(1.6rem - 6px);
    border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.switch-field input[type="checkbox"]:checked { background: var(--success); border-color: var(--success); }
.switch-field input[type="checkbox"]:checked::after { transform: translateX(1.4rem); }
.switch-field input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-field .switch-off, .switch-field .switch-on { color: #6b7280; }
.switch-field input:not(:checked) ~ .switch-off, .switch-field input:checked ~ .switch-on { color: #111827; font-weight: 600; }

/* Formulaires compacts (écrans larges) : le libellé est à gauche, le champ à droite.
   Sur petit écran, on garde le libellé au-dessus du champ. */
@media (min-width: 720px) {
    .form { --lib: 13rem; --decal: calc(var(--lib) + 1rem); }

    .form > label:not(.inline):not(.switch-field) {
        display: grid; grid-template-columns: var(--lib) minmax(0, 1fr);
        column-gap: 1rem; align-items: center; margin-top: .6rem;
    }
    .form > label:has(textarea) { align-items: start; }
    .form > label > input, .form > label > textarea { margin-top: 0; }

    .form .picker-group, .form .cover-group, .form .images-group {
        display: flow-root; max-width: calc(32rem + var(--decal));
        margin-top: .6rem; padding: 0 0 0 var(--decal);
    }
    .form .picker-group > legend, .form .cover-group > legend, .form .images-group > legend {
        float: left; width: var(--lib); margin-left: calc(-1 * var(--decal)); padding: .45rem 0 0;
    }

    .form .choix-group { display: grid; grid-template-columns: var(--lib) minmax(0, 1fr); column-gap: 1rem; align-items: center; margin-top: .6rem; }
    .form .choix-group .switch-field { margin-top: 0; }

    .form .auteur-row-champ, .form .image-row-champ { flex: 1 1 9rem; min-width: 8rem; }
    .form > .error { display: block; margin: .15rem 0 0 var(--decal); }
}

/* Utilisateur connecté (en-tête) et page de connexion */
.topbar { justify-content: space-between; }
.topbar-user { display: flex; align-items: center; gap: 1rem; color: #fff; }
.topbar-user form { margin: 0; }
.topbar-logout { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.5); color: #fff; padding: .25rem .7rem; }
.topbar-logout:hover { background: rgba(255,255,255,.28); }
.layout-public main { margin-left: auto; margin-right: auto; }
.connexion { max-width: 22rem; margin: 3rem auto 0; padding: 1.5rem; background: #fff; border: 1px solid var(--border); border-radius: 6px; }
.connexion h1 { margin-top: 0; font-size: 1.4rem; }
.form-connexion label { display: block; margin-top: 1rem; }
.form-connexion input { display: block; width: 100%; margin-top: .25rem; }
@media (max-width: 480px) { .topbar-nom { display: none; } }

.inline-rename input.facteur, .search input.facteur { flex: 0 0 5rem; width: 5rem; min-width: 0; text-align: right; }

/* Boutons d'action des listes : icône seule, nom de l'action en info-bulle au survol / focus */
.icon-btn {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; padding: 0; border-radius: 4px; border: 1px solid transparent;
    color: #fff; cursor: pointer; text-decoration: none; line-height: 1;
}
.icon-btn.icon-edit { background: var(--success); border-color: var(--success); }
.icon-btn.icon-delete { background: var(--danger); border-color: var(--danger); }
.icon-btn:hover { filter: brightness(1.12); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn::after {
    content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    padding: .2rem .5rem; border-radius: 4px; background: #1f2933; color: #fff; font-size: .8rem; font-weight: 400;
    white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s; z-index: 30;
}
.icon-btn:hover::after, .icon-btn:focus-visible::after { opacity: 1; }

.icon-btn.icon-save { background: var(--accent); border-color: var(--accent); }
.icon-btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
/* Dans la colonne d'actions (bord droit de l'écran) l'info-bulle s'aligne à droite du bouton pour ne pas déborder */
.actions .icon-btn::after { left: auto; right: 0; transform: none; }
.inline-rename .icon-btn { flex: none; }

/* Fiche : la description occupe une colonne à droite des champs */
.description-fiche { flex: 1 1 22rem; min-width: 18rem; background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: .25rem 1.25rem 1rem; overflow-wrap: anywhere; }
.description-fiche h2 { font-size: 1.1rem; margin-bottom: .25rem; }
.description-fiche h3, .description-fiche h4 { margin: 1rem 0 .25rem; }
.description-fiche blockquote { margin: .75rem 0; padding: .1rem 1rem; border-left: 3px solid var(--border); color: #4b5563; }
.description-fiche hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

/* Éditeur de texte riche */
.description-group { border: 1px solid var(--border); border-radius: 6px; margin: 1rem 0; padding: .5rem .75rem .75rem; background: #fff; }
.riche textarea:not([style*="none"]) { width: 100%; min-height: 8rem; }
.riche-barre { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; padding: .35rem; background: #f3f4f6; border: 1px solid var(--border); border-bottom: 0; border-radius: 4px 4px 0 0; }
.riche-btn { padding: .2rem .5rem; min-width: 2rem; background: #fff; color: #1f2937; border: 1px solid var(--border); border-radius: 4px; font-size: .85rem; cursor: pointer; }
.riche-btn:hover { background: #dbeafe; }
.riche-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 .25rem; }
.riche-zone { min-height: 12rem; max-height: 32rem; overflow-y: auto; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: 0 0 4px 4px; background: #fff; line-height: 1.5; }
.riche-zone:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.riche-zone blockquote { margin: .5rem 0; padding: .1rem 1rem; border-left: 3px solid var(--border); }

/* Indicateur oui/non (éditeur actif) */
.oui { color: var(--success); font-weight: 700; }
.non { color: var(--danger); font-weight: 700; }
td.statut-actif { text-align: center; }
.choix-aide { display: block; color: #6b7280; }
@media (min-width: 720px) { .form .choix-group .choix-aide { grid-column: 2; } }

/* Bulle de type (fiche BD) : même forme que les choix des sélecteurs */
.bulles { margin: .25rem 0 .5rem; }
.bulle { display: inline-block; padding: .15rem .75rem; border: 1px solid var(--border); border-radius: 999px; color: #1f2937; }
.bulle-magazine { background: #dcfce7; border-color: #86efac; }
.bulle-bd { background: #fef9c3; border-color: #fde047; }

.bd-infos .bulles { margin: 0 0 .5rem; }
.bulle-nouvelles { background: #fee2e2; border-color: #fca5a5; }
.search input[type=search] { flex: 1 1 16rem; min-width: 12rem; max-width: 26rem; }

/* Filtre par année de publication (listes BD et romans) */
.filtre-annee { display: inline-flex; align-items: center; gap: .5rem; }
.filtre-annee label { display: inline-flex; align-items: center; gap: .3rem; margin: 0; }
.filtre-annee input { width: 6rem; }

/* Bouton « Enlève tous les filtres » en tête de la barre de recherche */
.icon-btn.icon-reset { background: #6b7280; border-color: #6b7280; flex: none; }
.icon-btn.icon-reset::after { left: 0; transform: none; }

.filtre-annee .lib { display: inline-block; min-width: 4.6rem; }
/* Liste des BD : barre de recherche sur deux lignes, le filtre de cote sous le filtre d'année */
@media (min-width: 1000px) {
    .search.search-2lignes { display: grid; grid-template-columns: auto auto minmax(12rem, 26rem) auto auto auto auto; justify-content: start; align-items: center; }
    .search.search-2lignes .filtre-cote { grid-column: 5; grid-row: 2; }
    .search.search-2lignes .filtre-edition { grid-column: 3; grid-row: 2; justify-self: start; }
    .search.search-2lignes .filtre-annee-exacte { grid-column: 4; grid-row: 2; justify-self: start; }
    .search.search-2lignes input[type=search] { max-width: none; }
}
.search select { background: #fff; color: inherit; align-self: stretch; }

/* Champ mot de passe avec bouton « afficher / masquer » */
.champ-mdp { position: relative; display: block; }
.champ-mdp input { width: 100%; padding-right: 2.6rem; box-sizing: border-box; }
.mdp-afficher { position: absolute; top: 50%; right: .25rem; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; padding: 0; background: transparent; border: 0; color: #6b7280; cursor: pointer; }
.mdp-afficher[hidden] { display: none; }
.mdp-afficher:hover { color: var(--accent); }
.mdp-afficher:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 4px; }

/* Page d'accueil : tuiles de comptage */
.tuiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; }
@media (max-width: 1000px) { .tuiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .tuiles { grid-template-columns: 1fr; } }
.tuile { display: flex; flex-direction: column; border-radius: 8px; overflow: hidden; text-decoration: none; color: #1f2937;
         box-shadow: 0 1px 3px rgba(0,0,0,.15); transition: transform .12s, box-shadow .12s; }
.tuile:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,.18); }
.tuile:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tuile-corps { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem 1rem 1.25rem; }
.tuile-nombre { font-size: 2.5rem; font-weight: 700; line-height: 1.1; }
.tuile-libelle { font-size: 1rem; margin-top: .25rem; }
.tuile-pied { padding: .55rem 1rem; text-align: center; font-size: .9rem; font-weight: 600; }
.tuile-bd { background: #fffbe0; }
.tuile-bd .tuile-pied { background: #fbe38a; color: #4a3b05; }
.tuile-series { background: #e4f0ff; }
.tuile-series .tuile-pied { background: #a9cdf7; color: #123a63; }
.tuile-magazines { background: #e3f8e9; }
.tuile-magazines .tuile-pied { background: #9fdcb1; color: #14502a; }
.tuile-romans { background: #ffe7e5; }
.tuile-romans .tuile-pied { background: #f5b3ae; color: #6b1d17; }

/* Icône de la rubrique (celle du menu) devant le titre de page */
main[style*="--icone-page"] > h1::before { content: var(--icone-page); margin-right: .5rem; font-size: .85em; }

/* Tableau de bord : widgets « derniers ajouts », pleine largeur */
.widget { margin-top: 1.5rem; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.widget h2 { margin: 0; padding: .6rem 1rem; font-size: 1.05rem; }
.widget table { box-shadow: none; background: transparent; }
.widget th, .widget td { border-bottom-color: rgba(0,0,0,.08); }
.widget-vide { margin: 0; padding: 1rem; }
.widget-bd { background: #fffbe0; }
.widget-bd h2 { background: #fbe38a; color: #4a3b05; }
.widget-romans { background: #ffe7e5; }
.widget-romans h2 { background: #f5b3ae; color: #6b1d17; }

/* Boutons Enregistrer / Annuler des formulaires : barre collée en haut à droite, toujours visible au défilement */
.form > .barre-actions { position: sticky; top: var(--topbar-h); z-index: 15; display: flex; justify-content: flex-end; align-items: stretch; gap: .5rem;
    margin: 0 0 .5rem; padding: .5rem 0; background: #f7f7f8; border-bottom: 1px solid var(--border); }
.form > .barre-actions .button { display: inline-flex; align-items: center; }
/* le défilement horizontal de <main> empêcherait la barre de rester collée : inutile sur les formulaires */
main:has(> form.form) { overflow-x: visible; }

/* Barre de commandes d'une fiche */
.nav-fiche { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 1rem; }
.btn-nav { display: inline-block; padding: .35rem .8rem; border: 1px solid #9cc7ee; border-radius: 6px; background: #d9ecfc; color: #14507f; text-decoration: none; font-size: .9rem; line-height: 1.3; }
.btn-nav:hover { background: #c3dff8; }
.btn-nav.btn-modifier { border-color: #8fcf9f; background: #d6f1dc; color: #1c6a31; }
.btn-nav.btn-modifier:hover { background: #bfe8c9; }
.btn-nav.desactive { opacity: .45; cursor: default; pointer-events: none; }
.nav-position { display: inline-block; padding: .3rem .8rem; border: 1px solid #c9c9c9; border-radius: 999px; background: #fff; color: #555; font-size: .85rem; font-variant-numeric: tabular-nums; cursor: default; user-select: none; }

/* Mode d'affichage liste / grille */
.barre-compteur { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: .25rem 0 .75rem; }
.barre-compteur .compteur { margin: 0; }
.modes { display: inline-flex; gap: .25rem; }
.mode { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 2.1rem; height: 2.1rem; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: #555; text-decoration: none; }
.mode:hover { background: #eef2f6; }
.mode.actif { background: #d9ecfc; border-color: #9cc7ee; color: #14507f; }
.mode[data-tip]:hover::after, .mode[data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; top: calc(100% + 4px); right: 0; z-index: 20; padding: .2rem .5rem; border-radius: 4px; background: #333; color: #fff; font-size: .8rem; white-space: nowrap; }
/* Grille : couvertures 2× plus grandes que les miniatures de la liste (3,5 rem -> 8,5 rem de large) */
.grille-couvertures { display: grid; grid-template-columns: repeat(auto-fill, 8.5rem); gap: .9rem; justify-content: start; }
.couverture-tuile { display: block; width: 8.5rem; aspect-ratio: 2 / 3; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; background: #fff; }
.couverture-tuile:hover, .couverture-tuile:focus-visible { box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.couverture-tuile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.couverture-tuile img.couv-defaut { object-fit: contain; padding: .5rem; }

/* Bouton d'options (en-tête) et fenêtre d'options superposée */
.topbar-options { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem; padding: 0; background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.5); color: #fff; }
.topbar-options:hover { background: rgba(255,255,255,.28); }
.topbar-options[data-tip]:hover::after, .topbar-options[data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; padding: .2rem .5rem; border-radius: 4px; background: #333; color: #fff; font-size: .8rem; white-space: nowrap; }
.options { border: 0; border-radius: 10px; padding: 0; width: min(30rem, calc(100vw - 2rem)); box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.options::backdrop { background: rgba(0,0,0,.4); }
.options-form { padding: 1.25rem 1.5rem; }
.options-form h2 { margin: 0 0 1rem; font-size: 1.2rem; }
.options fieldset { border: 1px solid var(--border); border-radius: 6px; margin: 0 0 1rem; padding: .5rem .9rem .75rem; }
.options legend { padding: 0 .35rem; font-weight: 600; }
.options-ligne { display: flex; align-items: center; gap: 1rem; padding: .3rem 0; }
.options-nom { flex: 1 1 8rem; }
.options-ligne label { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.options input[type="radio"] { display: inline; width: auto; margin: 0; }
.options-nb { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-weight: 600; }
.options-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; }
.options-actions .secondaire { background: #fff; color: var(--accent); }

/* Logo « 8 » (huitième version) dans le titre de l'en-tête */
.brand { display: inline-flex; align-items: center; gap: .4rem; }
.logo-8 { display: block; flex: none; transform: skewX(-12deg); margin-left: .15rem; } /* penché comme un chiffre en italique */

/* Page de connexion : livre ouvert pâle en fond d'écran, vu en perspective comme par le lecteur (bord du bas plus proche) */
.layout-public { position: relative; overflow: hidden; min-height: calc(100vh - var(--topbar-h)); }
.layout-public::before { content: ''; position: absolute; left: 50%; top: 58%; width: min(62rem, 94%); aspect-ratio: 800 / 540; pointer-events: none;
    background: url('/assets/livre-ouvert.svg') center / contain no-repeat;
    transform: translate(-50%, -50%) perspective(1100px) rotateX(42deg) rotateZ(-2deg); }
.layout-public main { position: relative; z-index: 1; }

/* Ligne survolée d'une liste : fond vert très pâle */
main > table tbody tr:hover > td { background: #f0faf3; }

/* Listes BD et romans : police plus compacte (-2 px environ), cotes alignées à droite */
.table-liste { font-size: .875rem; }
.table-liste td.nombre { text-align: right; white-space: nowrap; }

/* Les deux boîtes de saisie finissent au même bord droit et ont la même largeur */
.options-nb input, .options-montant input { width: 6rem; box-sizing: border-box; }
.options-montant { display: inline-flex; align-items: center; font-weight: 400; white-space: nowrap; }
.options-montant input { text-align: left; }
.options-form small + label { margin-top: .9rem; }

/* Page « Valeur collection » */
.valeur-grille { display: grid; grid-template-columns: minmax(18rem, 27rem) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 1000px) { .valeur-grille { grid-template-columns: 1fr; } }
.widget-stats { background: #e4f0ff; }
.widget-stats h2 { background: #a9cdf7; color: #123a63; }
.table-stats { width: 100%; background: transparent; }
.table-stats th { font-weight: 400; }
.table-stats td { text-align: right; font-weight: 600; white-space: nowrap; }
.table-stats th, .table-stats td { padding: .4rem 1rem; border-bottom: 1px solid rgba(18, 58, 99, .12); }
.stats-note { margin: .6rem 1rem 1rem; color: #4b5b6b; font-size: .85rem; }
.graphe { position: relative; height: 22rem; margin: 1rem; }
.graphe-annee { display: flex; align-items: center; gap: .6rem; margin: 0 1rem 1rem; }
.graphe-annee select { background: #fff; }
.valeur-grille .widget { margin-top: 0; }

/* Barres de filtre des listes : tous les contrôles (champs, listes, boutons, bouton « enlever les filtres ») ont la même hauteur */
.search { --h-controle: 2.4rem; }
.search :is(input:not([type=hidden]), select, button, .button, .icon-btn) { height: var(--h-controle); box-sizing: border-box; }
.search .icon-btn { width: var(--h-controle); }

/* Page « Valeur collection » : 4 camemberts sur une deuxième ligne */
.valeur-pies { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; margin-top: 1.5rem; }
@media (max-width: 1300px) { .valeur-pies { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .valeur-pies { grid-template-columns: 1fr; } }
.valeur-pies .widget { margin-top: 0; }
.graphe-pie { height: 20rem; }

/* Graphiques pleine largeur (styles, éditions) */
.widget-large { margin-top: 1.5rem; }
.graphe-large { height: 26rem; }

.aide-clic { font-weight: 400; font-size: .8rem; opacity: .8; margin-left: .4rem; }
