/*
  Identité visuelle "encre.katulu.fr"
  Papier chaud + encre bleu-nuit, accent pétrole (écho à l'encre de
  seiche / la mascotte poulpe de katulu.fr). Bordures fines plutôt
  qu'ombres portées : esprit gravure / papier plutôt que carte SaaS.
*/

:root {
    --papier: #faf6ef;
    --papier-ombre: #f1ead9;
    --encre: #1c2333;
    --encre-douce: #5b6479;
    --accent: #2b5c6b;
    --accent-clair: #3e7385;
    --bordure: #e1d9cb;
    --erreur: #9b3b3b;
    --erreur-fond: #f7e9e6;
    --succes: #3b7a5a;
    --succes-fond: #e9f2ec;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--papier);
    color: var(--encre);
    font-family: 'Public Sans', -apple-system, 'Segoe UI', sans-serif;
    line-height: 1.5;
}

h1, h2, h3 {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 0.5em 0;
}

h1 { font-size: 32px; }
h2 { font-size: 22px; margin-top: 2em; }
h3 { font-size: 17px; }

a {
    color: var(--accent);
}

/* --- En-tête / navigation --- */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    border-bottom: 1px solid var(--bordure);
    background: var(--encre);
    color: var(--papier);
}

.marque {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Fraunces', Georgia, serif;
    font-size: 22px;
    font-weight: 600;
    color: var(--papier-ombre);
    text-decoration: none;
}

.marque-goutte svg{
    width: 48px;
    height: 48px;
}

#logo-rappel {
    text-align: center;
    animation: 0.8s ease 0s infinite alternate none running bounce;
}

#logo-rappel svg {
    width: 124px;
    height: 124px;
    margin: 1rem auto;
}


@keyframes bounce {
    0% {
        transform: translateY(0)
    }

    100% {
        transform: translateY(-.25rem)
    }
}

.site-footer {
    margin-top: 80px;
    padding: 40px 48px 24px;
    font-size: .85rem;
    border: 1px solid var(--bordure);
    background: var(--papier-ombre);
}

.site-footer__inner {
    display: grid;
    max-width: 1100px;
    margin: 0 auto 28px;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
    gap: 40px;
}

.site-footer__legal {
    display: flex;
    max-width: 1100px;
    margin: 0 auto;
    padding-top: 20px;
    border-top: .5px solid var(--border-color);
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.site-footer__brand {
    display: flex;
    flex-direction: column;
    text-align: center;
    align-items: center;
    gap: 8px;
}

.site-footer__follow {
    text-align: right;
}

.site-footer__nav-list {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
    gap: 8px;
}

.site-footer__follow-list {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
    align-items: flex-end;
    gap: 8px;
}

.site-nav {
    display: flex;
    gap: 24px;
    align-items: center;
}

.site-nav a {
    color: var(--papier-ombre);
    text-decoration: none;
    font-size: 15px;
}

.site-nav a:hover {
    color: var(--bordure);
}

/* Bouton rendu visuellement comme un lien (formulaires POST de
   déconnexion, TASK-18). */
.lien-bouton {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.site-nav-form {
    display: flex;
    align-items: center;
}

.site-nav-form .lien-bouton {
    color: var(--papier-ombre);
    font-size: 15px;
    text-decoration: none;
}

.site-nav-form .lien-bouton:hover {
    color: var(--bordure);
}

.deconnexion-form {
    margin-top: 16px;
}

/* --- Structure de page --- */
.conteneur {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

.conteneur-large {
    max-width: 1600px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

.lien-retour {
    display: inline-block;
    color: var(--encre-douce);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 24px;
}

.lien-retour:hover {
    color: var(--accent);
}

/* --- Alertes --- */
.alerte {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 24px;
    font-size: 14px;
}

.alerte-erreur {
    background: var(--erreur-fond);
    color: var(--erreur);
    border: 1px solid var(--erreur);
}

.alerte-succes {
    background: var(--succes-fond);
    color: var(--succes);
    border: 1px solid var(--succes);
}

.alerte-info {
    background: var(--fond-survol, #eee8dc);
    color: var(--encre, #1c2333);
    border: 1px solid var(--bordure, #ddd6ca);
}

/* --- Cloche « Partages reçus » (en-tête) --- */
.lien-cloche {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.lien-cloche .pastille {
    position: absolute;
    top: -8px;
    right: -12px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--erreur, #c62828);
    color: #fff;
    font-size: 11px;
    line-height: 16px;
    text-align: center;
    font-weight: 600;
}

/* --- Page « Partages reçus » --- */
.liste-partages-recus {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.liste-partages-recus li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.liste-partages-recus .partage-meta {
    color: var(--encre-douce, #4a5468);
    font-size: 13px;
}

/* --- Gestion des partages (section-boîte) --- */
.partager-liste {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.partager-liste li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* --- Formulaires --- */
.formulaire {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 420px;
    margin-bottom: 8px;
}

.champ {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.champ label {
    font-size: 14px;
    color: var(--encre-douce);
}

.champ input[type="text"],
.champ input[type="email"],
.champ input[type="password"],
.champ textarea {
    font-family: inherit;
    font-size: 15px;
    padding: 10px 12px;
    border: 1px solid var(--bordure);
    border-radius: 4px;
    background: #fff;
    color: var(--encre);
}

.champ input:focus,
.champ textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.champ-case {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: var(--encre);
    cursor: pointer;
}

.champ-case input {
    margin-top: 3px;
}

/* --- Boutons --- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background: var(--encre);
    color: var(--papier);
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

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

.btn-secondaire {
    background: transparent;
    color: var(--encre);
    border: 1px solid var(--bordure);
}

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

.btn-danger {
    background: transparent;
    color: var(--erreur);
    border: 1px solid var(--erreur);
}

.btn-danger:hover {
    background: var(--erreur);
    color: var(--papier);
}

.btn-icone {
    padding: 6px 10px;
    font-size: 13px;
}

/* --- Connexion via comptes externes (OAuth) --- */
.oauth-boutons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 420px;
    margin: 20px 0 8px;
}

.oauth-separateur {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0;
    color: var(--encre-douce);
    font-size: 13px;
}

.oauth-separateur::before,
.oauth-separateur::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--bordure);
}

.oauth-bouton {
    width: 100%;
}

.book-menu {
    margin: 1rem 0;
}

/* --- Barre d'outils de la page livre (TASK-11) --- */
.barre-outils-livre {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 1rem 0 1.5rem;
}

.menu-deroulant {
    position: relative;
    display: inline-block;
}

.menu-deroulant [data-menu-bouton] {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Menu flottant ancré à gauche de son déclencheur (barre d'outils),
   à l'inverse du menu kebab des chapitres qui s'ouvre vers la gauche.
   Double classe pour l'emporter sur `.menu-flottant { right: 0 }`
   quel que soit l'ordre des règles dans la feuille. */
.menu-flottant.menu-flottant--gauche {
    right: auto;
    left: 0;
}

.filtre-chapitres {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 240px;
    max-width: 420px;
    padding: 0 10px;
    border: 1px solid var(--bordure);
    border-radius: 6px;
    background: #fff;
}

.filtre-chapitres svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--encre-douce);
}

.filtre-chapitres input {
    flex: 1;
    min-width: 0;
    padding: 8px 0;
    border: none;
    outline: none;
    font: inherit;
    font-size: 14px;
    background: transparent;
    color: var(--encre);
}

.filtre-chapitres .btn {
    margin: 4px 0;
    flex-shrink: 0;
}

.menu-item--actif {
    background: var(--papier-ombre);
    font-weight: 600;
}

/* --- Page livre : vue "cartes" des chapitres --- */
.chapitre-item[hidden] {
    display: none;
}

.chapitre-item-mots {
    flex-shrink: 0;
    font-size: 13px;
    color: var(--encre-douce);
}

#zone-chapitres.vue-liste .chapitre-item-mots {
    margin-left: 4px;
}

#zone-chapitres.vue-cartes .liste-chapitres {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

#zone-chapitres.vue-cartes .chapitre-item {
    position: relative;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-height: 96px;
    padding: 16px;
    border-left: 4px solid var(--accent);
}

#zone-chapitres.vue-cartes .chapitre-item-titre {
    font-size: 16px;
    padding-right: 32px;
}

#zone-chapitres.vue-cartes .chapitre-menu {
    position: absolute;
    top: 12px;
    right: 12px;
    margin: 0;
}

/* --- Page livre : volet de visualisation d'un chapitre (TASK-12) --- */
.barre-outils-apercu {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.barre-outils-apercu svg {
    width: 16px;
    height: 16px;
}

#apercu-toggle[aria-pressed="true"] {
    background: var(--encre);
    color: var(--papier);
}

.livre-corps.avec-apercu {
    display: flex;
    align-items: flex-start;
    gap: 24px;
}

.livre-corps.avec-apercu #zone-chapitres {
    flex: 1;
    min-width: 0;
}

/* Liste resserrée tant que le volet occupe la moitié droite :
   on ne garde que le titre et le menu par ligne. */
.livre-corps.avec-apercu .chapitre-item {
    flex-wrap: nowrap;
    cursor: pointer;
}

.livre-corps.avec-apercu .chapitre-deplacer-partie,
.livre-corps.avec-apercu .chapitre-item-mots {
    display: none;
}

.livre-corps.avec-apercu .chapitre-item-titre {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.livre-corps.avec-apercu .partie-renommer {
    flex-basis: 100%;
}

.chapitre-item--selectionne {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.apercu-chapitre {
    flex-shrink: 0;
    width: 480px;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 16px 20px;
    border: 1px solid var(--bordure);
    border-radius: 8px;
    background: #fff;
}

.apercu-entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.apercu-entete h2 {
    margin: 0;
}

.apercu-invite {
    color: var(--encre-douce);
    font-style: italic;
}

.apercu-extrait {
    margin: 0 0 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--bordure);
    font-size: 14px;
    line-height: 1.6;
    color: var(--encre);
    white-space: pre-line;
}

.apercu-details {
    margin: 8px 0 20px;
}

.apercu-ligne {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 7px 0;
    border-bottom: 1px solid var(--bordure);
    font-size: 14px;
}

.apercu-ligne dt {
    color: var(--encre-douce);
    flex-shrink: 0;
}

.apercu-ligne dd {
    margin: 0;
    text-align: right;
    overflow-wrap: anywhere;
}

.apercu-ligne--bloc {
    flex-direction: column;
    gap: 4px;
}

.apercu-ligne--bloc dd {
    text-align: left;
}

@media (max-width: 900px) {
    .livre-corps.avec-apercu {
        flex-direction: column;
    }

    .apercu-chapitre {
        width: 100%;
        position: static;
        max-height: none;
    }
}

.toolbar-bouton svg {
    height: 18px;
    width: 18px;
}

/* --- Grille de la bibliothèque (couvertures de livres) --- */
.grille-livres {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.carte-livre {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--bordure);
    border-left: 4px solid var(--accent);
    border-radius: 2px;
    padding: 20px 16px;
    background: #fff;
    min-height: 140px;
}

.carte-livre:hover {
    border-left-color: var(--encre);
}

.carte-livre-lien {
    display: block;
    text-decoration: none;
    color: var(--encre);
    flex-grow: 1;
}

.carte-livre-lien h3 {
    margin: 0 0 8px 0;
}

.carte-livre .date-modification {
    font-size: 12px;
    color: var(--encre-douce);
}

.carte-livre-exporter {
    margin-top: 12px;
    align-self: flex-start;
    font-size: 12px;
}

.carte-livre-couverture {
    display: block;
    width: calc(100% + 32px);
    height: 140px;
    object-fit: cover;
    border-radius: 2px;
    margin: -20px -16px 12px -16px;
}

.couverture-apercu {
    display: block;
    max-width: 200px;
    max-height: 200px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--bordure);
}

.etat-vide {
    color: var(--encre-douce);
    font-style: italic;
    padding: 24px 0;
}

/* --- Grille des fiches (personnages, lieux) --- */
.grille-fiches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.carte-fiche {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--bordure);
    border-left: 4px solid var(--accent);
    border-radius: 2px;
    padding: 20px 16px;
    background: #fff;
}

.carte-fiche-image {
    display: block;
    width: calc(100% + 32px);
    height: 160px;
    object-fit: cover;
    border-radius: 2px;
    margin: -20px -16px 12px -16px;
}

.carte-fiche h3 {
    margin: 0 0 4px 0;
}

.carte-fiche-meta {
    font-size: 13px;
    color: var(--encre-douce);
    margin-bottom: 8px;
}

.carte-fiche-etiquettes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.etiquette {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--papier-ombre);
    color: var(--encre-douce);
    font-size: 12px;
}

.carte-fiche-description {
    font-size: 14px;
    color: var(--encre);
    margin: 0 0 12px 0;
    overflow-wrap: break-word;
}

.carte-fiche-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

/* --- Liste des chapitres --- */
.liste-chapitres {
    list-style: none;
    padding: 0;
    margin: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chapitre-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--bordure);
    border-radius: 4px;
    background: #fff;
}

.chapitre-item-titre {
    flex: 1;
    text-decoration: none;
    color: var(--encre);
    font-size: 15px;
}

.chapitre-item-titre:hover {
    color: var(--accent);
}

.chapitre-item > form {
    display: inline;
}

/* --- Menu d'actions par chapitre (kebab) --- */
.chapitre-menu {
    position: relative;
    margin-left: auto;
}

.chapitre-menu-declencheur {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 18px;
    line-height: 1;
    background: transparent;
    border: 1px solid var(--bordure);
    border-radius: 6px;
    color: var(--encre-douce);
    cursor: pointer;
}

.chapitre-menu-declencheur:hover {
    background: var(--papier-ombre);
    color: var(--encre);
}

.menu-flottant {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    min-width: 190px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--bordure);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(28, 35, 51, 0.12);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* L'attribut `hidden` doit l'emporter sur le display:flex ci-dessus. */
.menu-flottant[hidden] {
    display: none;
}

.chapitre-item .menu-flottant form {
    display: block;
    margin: 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    font: inherit;
    font-size: 14px;
    color: var(--encre);
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.menu-item:hover {
    background: var(--papier-ombre);
}

.menu-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--encre-douce);
}

.menu-item[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

.menu-item[disabled]:hover {
    background: transparent;
}

.menu-item--danger,
.menu-item--danger svg {
    color: var(--erreur);
}

form.chapitre-renommer {
    display: flex;
    flex-basis: 100%;
    gap: 8px;
    margin-top: 4px;
}

form.chapitre-renommer.hidden {
    display: none;
}

.chapitre-renommer input[type="text"] {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--bordure);
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
}

/* --- Boîte de section (fiche livre, réglages...) --- */
.section-boite {
    border: 1px solid var(--bordure);
    border-radius: 4px;
    padding: 24px;
    background: #fff;
    margin-bottom: 24px;
}

/* --- Fiche chapitre : sections "Personnages / Lieux présents" --- */
.fiche-presences {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--bordure);
}

.fiche-presence-section {
    flex: 1;
    min-width: 220px;
}

.fiche-presence-section h3 {
    margin: 0 0 12px 0;
    font-size: 15px;
}

.fiche-presence-section .etat-vide {
    padding: 0;
    font-size: 14px;
}

.liste-presences {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
}

.liste-presences .champ-case {
    align-items: center;
}

.liste-presences .champ-case input {
    margin-top: 0;
}

/* --- Page chapitre : plan latéral + contenu --- */
.page-chapitre {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

.plan-lateral {
    width: 240px;
    flex-shrink: 0;
    position: sticky;
    top: 24px;
    transition: width 0.15s ease;
}

.plan-entete {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.plan-toggle {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border: 1px solid var(--bordure);
    border-radius: 4px;
    background: #fff;
    color: var(--encre-douce);
    font-size: 14px;
    cursor: pointer;
}

.plan-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Plan replié : seule la poignée reste visible. */
.plan-lateral.replie {
    width: 40px;
}

.plan-lateral.replie .plan-entete {
    justify-content: center;
}

.plan-lateral.replie .plan-corps {
    display: none;
}

.plan-nouveau-chapitre {
    margin-bottom: 12px;
}

.plan-nouveau-chapitre .btn {
    width: 100%;
}

.plan-filtre {
    margin-bottom: 12px;
}

.plan-filtre input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--bordure);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
}

.plan-filtre input:focus {
    outline: none;
    border-color: var(--accent);
}

.plan-liste {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 70vh;
    overflow-y: auto;
}

.plan-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border-left: 2px solid transparent;
    text-decoration: none;
    color: var(--encre-douce);
    font-size: 14px;
    border-radius: 2px;
}

.plan-item:hover {
    background: var(--papier-ombre);
    color: var(--encre);
}

.plan-item.actif {
    border-left-color: var(--accent);
    background: var(--papier-ombre);
    color: var(--encre);
    font-weight: 500;
}

.plan-item-mots {
    font-size: 11px;
    color: var(--encre-douce);
}

.contenu-chapitre {
    flex: 1;
    min-width: 0;
}


@media (max-width: 900px) {
    .page-chapitre {
        flex-direction: column;
    }

    .plan-lateral {
        width: 100%;
        position: static;
    }
}

/* --- Parties (regroupement optionnel de chapitres, livre.php) --- */
.partie-groupe {
    margin: 24px 0;
}

.partie-entete {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.partie-entete h3 {
    margin: 0;
    flex: 1;
}

.partie-renommer {
    display: flex;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.partie-renommer input[type="text"] {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--bordure);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.chapitre-deplacer-partie select {
    padding: 6px 8px;
    border: 1px solid var(--bordure);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    color: var(--encre);
}

.champ select {
    font-family: inherit;
    font-size: 15px;
    padding: 10px 12px;
    border: 1px solid var(--bordure);
    border-radius: 4px;
    background: #fff;
    color: var(--encre);
}

.hidden {
    display : none;
}

.close-btn{
    width: 24px;
    height: 24px;
    background: var(--encre);
    border: none;
    border-radius: 8px;
    color: var(--papier);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.close-btn svg {
    width: 14px;
    height: 14px;
}

.book_title_wrapper{
    padding: .5rem 1rem;
    border-bottom: 1px solid var(--drawer-ktl-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

/* --- Bloc-notes privé (TASK-22) ------------------------------------ */

.notes-bouton {
    position: fixed;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--accent);
    color: var(--papier);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(28, 35, 51, 0.22);
    z-index: 900;
}
.notes-bouton:hover { background: var(--accent-clair); }
.notes-bouton svg { width: 22px; height: 22px; }

.notes-popover,
.notes-epingle { display: flex; }
.notes-popover[hidden],
.notes-epingle[hidden] { display: none; }

.notes-popover {
    position: fixed;
    right: 74px;
    top: 50%;
    transform: translateY(-50%);
    width: 320px;
    max-width: calc(100vw - 90px);
    flex-direction: column;
    background: var(--papier);
    border: 1px solid var(--bordure);
    border-radius: 6px;
    padding: 12px;
    box-shadow: 0 4px 16px rgba(28, 35, 51, 0.18);
    z-index: 901;
}
.notes-popover-entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.notes-popover .notes-erreur { margin: 4px 0 8px; }

.notes-liste {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 232px; /* ~5 lignes ; scroll interne au-delà */
    overflow-y: auto;
}
.notes-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    border-bottom: 1px solid var(--bordure);
    font-size: 13px;
}
.notes-row:last-child { border-bottom: none; }
.notes-row-texte {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    padding: 6px 0;
    font: inherit;
    color: var(--encre);
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notes-row-texte:hover { color: var(--accent); }
.notes-row-actions {
    display: inline-flex;
    gap: 2px;
    flex-shrink: 0;
}
.notes-row-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    padding: 4px;
    opacity: 0.6;
}
.notes-row-actions button:hover { opacity: 1; }

.notes-voir-tout {
    display: block;
    margin-top: 8px;
    text-align: right;
    font-size: 13px;
}

.notes-epingle {
    position: fixed;
    width: 340px;
    max-width: calc(100vw - 24px);
    flex-direction: column;
    background: var(--papier);
    border: 1px solid var(--encre);
    border-radius: 6px;
    box-shadow: 0 6px 24px rgba(28, 35, 51, 0.28);
    z-index: 950;
    overflow: hidden;
}
.notes-epingle-entete {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--encre);
    color: var(--papier);
    cursor: move;
}
.notes-epingle-titre { font-weight: 600; font-size: 13px; flex: 1; }
.notes-epingle-etat { font-size: 11px; opacity: 0.8; white-space: nowrap; }
.notes-epingle-fermer {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 2px 4px;
}
.notes-epingle-zone {
    border: none;
    padding: 12px;
    margin: 0;
    width: 100%;
    min-height: 200px;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    background: var(--papier);
    color: var(--encre);
    outline: none;
}
.notes-epingle-pied {
    padding: 6px 10px;
    border-top: 1px solid var(--bordure);
    text-align: right;
    font-size: 12px;
    color: var(--encre-douce);
}
.notes-compteur.depasse { color: var(--erreur); font-weight: 600; }

/* Page /notes */
.notes-page-barre {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
    flex-wrap: wrap;
    margin: 12px 0;
}
.notes-tout-cocher-label { font-size: 13px; color: var(--encre-douce); }
.notes-page-liste { list-style: none; margin: 0; padding: 0; }
.notes-page-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 4px;
    border-bottom: 1px solid var(--bordure);
}
.notes-page-apercu {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notes-page-date {
    color: var(--encre-douce);
    font-size: 12px;
    white-space: nowrap;
}
.notes-pagination {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    font-size: 14px;
}

@media (max-width: 700px) {
    .notes-bouton { right: 12px; }
    .notes-popover {
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
    }
    .notes-epingle {
        inset: 0 !important;
        left: 0 !important;
        top: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: none;
        height: 100%;
        border-radius: 0;
    }
    .notes-epingle-zone { flex: 1; min-height: 0; resize: none; }
}