/* Espace de rédaction */
body.admin { background: var(--creme); min-height: 100vh; }
.chargement { padding: 4rem; text-align: center; color: var(--gris); }

/* ---------- Boutons, champs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .35rem; font: inherit; font-weight: 600; font-size: .95rem;
  padding: .55rem 1rem; border-radius: 9px; border: 1px solid var(--ligne); background: var(--papier); color: var(--encre);
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { border-color: var(--vert); color: var(--vert-fonce); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-principal { background: var(--vert); border-color: var(--vert); color: #fff; }
.btn-principal:hover { background: var(--vert-fonce); border-color: var(--vert-fonce); color: #fff; }
.btn-accent { background: color-mix(in srgb, var(--pousse) 22%, var(--papier)); border-color: color-mix(in srgb, var(--pousse) 55%, transparent); color: var(--vert-fonce); }
.btn-discret { background: transparent; border-color: transparent; color: var(--gris); }
.btn-discret:hover { background: var(--papier); border-color: var(--ligne); }
.btn-danger:hover { color: #b3261e; border-color: #e4a7a2; }
.btn-petit { padding: .35rem .7rem; font-size: .85rem; }
.btn-large { width: 100%; justify-content: center; padding: .8rem; font-size: 1.02rem; }
.lien { background: none; border: 0; padding: 0; font: inherit; color: var(--gris); cursor: pointer; text-decoration: underline; text-underline-offset: .2em; font-size: .88rem; }
.lien:hover { color: var(--vert-fonce); }
.champ, .admin input:not([type=checkbox]):not([type=file]), .admin select, .admin textarea {
  width: 100%; font: inherit; font-size: .95rem; color: var(--encre); background: var(--papier);
  border: 1px solid var(--ligne); border-radius: 8px; padding: .55rem .7rem;
}
.champ:focus, .admin input:focus, .admin select:focus, .admin textarea:focus { outline: 2px solid color-mix(in srgb, var(--pousse) 70%, transparent); outline-offset: 0; border-color: var(--vert); }
.admin label { display: grid; gap: .3rem; font-size: .88rem; font-weight: 600; color: var(--gris); }
.admin label.case { display: flex; align-items: flex-start; gap: .55rem; font-weight: 400; color: var(--encre); font-size: .93rem; cursor: pointer; }
.admin label.case input { margin-top: .25em; accent-color: var(--vert); }
.badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .76rem; font-weight: 700; letter-spacing: .02em; }
.badge-publie { background: #dff3d9; color: #1e6b2f; }
.badge-brouillon { background: #f2ecd9; color: #7a6320; }
.badge-une { background: #e0f0fa; color: #1b6a95; }
@media (prefers-color-scheme: dark) {
  .badge-publie { background: #1d3b22; color: #9fe0a6; }
  .badge-brouillon { background: #3a321b; color: #e9cf83; }
  .badge-une { background: #173244; color: #8fd0f5; }
}
kbd { font: 600 .8em var(--texte); padding: .1em .4em; border: 1px solid var(--ligne); border-bottom-width: 2px; border-radius: 4px; background: var(--papier); }

/* ---------- Connexion ---------- */
.ecran-connexion { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: radial-gradient(900px 400px at 80% 0%, rgba(124, 193, 66, .25), transparent 60%), radial-gradient(700px 400px at 0% 100%, rgba(47, 159, 211, .18), transparent 60%), var(--creme); }
.carte-connexion { width: min(420px, 100%); background: var(--papier); border-radius: 18px; box-shadow: var(--ombre); padding: 2.2rem 2rem; display: grid; gap: 1rem; }
.logo-connexion { width: 78px; margin: 0 auto -.3rem; }
.carte-connexion h1 { font-family: var(--titres); color: var(--foret); text-align: center; margin: 0; font-weight: 600; }
.carte-connexion .intro { text-align: center; color: var(--gris); margin: -.4rem 0 .3rem; font-size: .95rem; }
.erreur { color: #b3261e; background: #fbe9e7; padding: .55rem .8rem; border-radius: 8px; margin: 0; font-size: .92rem; }
.retour-site { text-align: center; color: var(--gris); font-size: .9rem; }

/* ---------- Cadre ---------- */
.admin-cadre { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.admin-barre { background: #10291c; color: #cfe0d2; padding: 1.2rem .9rem; display: flex; flex-direction: column; gap: 1.6rem; position: sticky; top: 0; height: 100vh; }
.admin-marque { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: #fff; padding: 0 .4rem; }
.admin-marque img { width: 40px; }
.admin-marque span { font-family: var(--titres); line-height: 1.05; font-size: .95rem; color: #b9e38f; display: flex; flex-direction: column; }
.admin-marque b { color: #fff; font-size: 1.12rem; }
.admin-barre nav { display: grid; gap: .2rem; }
.admin-barre nav a { display: flex; align-items: center; gap: .65rem; padding: .6rem .7rem; border-radius: 9px; color: #cfe0d2; text-decoration: none; font-weight: 600; font-size: .95rem; }
.admin-barre nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.admin-barre nav a.actif { background: rgba(124, 193, 66, .18); color: #e7f7d8; }
.admin-barre .ico { width: 1.2em; text-align: center; opacity: .8; }
.admin-barre-bas { margin-top: auto; display: grid; gap: .6rem; padding: 0 .7rem; font-size: .9rem; }
.admin-barre-bas a, .admin-barre-bas .lien { color: #9fb8a5; text-align: left; }
.admin-principal { padding: 2rem 2.2rem 4rem; min-width: 0; }
.admin-tete { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.admin-tete h1 { font-family: var(--titres); font-weight: 600; color: var(--foret); margin: 0; font-size: 2rem; }
.sous { margin: .2rem 0 0; color: var(--gris); }

/* ---------- Liste ---------- */
.filtres { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.filtres .champ { max-width: 280px; }
.onglets { display: inline-flex; background: var(--papier); border: 1px solid var(--ligne); border-radius: 10px; padding: 3px; }
.onglets button { font: inherit; font-size: .9rem; font-weight: 600; border: 0; background: none; padding: .4rem .85rem; border-radius: 7px; color: var(--gris); cursor: pointer; }
.onglets button.actif { background: var(--vert); color: #fff; }
.liste-articles { display: grid; gap: .6rem; }
.ligne-article { display: grid; grid-template-columns: 96px 1fr auto; gap: 1rem; align-items: center; background: var(--papier); border-radius: 12px; padding: .6rem 1rem .6rem .6rem; box-shadow: 0 1px 2px rgba(23, 61, 42, .06); border: 1px solid transparent; }
.ligne-article:hover { border-color: var(--ligne); }
.vignette { width: 96px; aspect-ratio: 16/10; border-radius: 8px; overflow: hidden; background: linear-gradient(135deg, #2e8b4a, #7cc142); }
.vignette img { width: 100%; height: 100%; object-fit: cover; }
.ligne-titre { font-family: var(--titres); font-weight: 600; font-size: 1.1rem; color: var(--foret); text-decoration: none; line-height: 1.25; }
.ligne-meta { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; color: var(--gris); font-size: .85rem; margin-top: .25rem; }
.ligne-actions { display: flex; gap: .2rem; }
.liste-vide { text-align: center; padding: 3.5rem 1rem; background: var(--papier); border-radius: 14px; border: 2px dashed var(--ligne); color: var(--gris); }
.liste-vide img { width: 70px; margin: 0 auto .5rem; opacity: .9; }

/* ---------- Éditeur ---------- */
.admin-principal:has(.editeur) { padding: 0; }
.editeur-tete { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 1rem; padding: .7rem 1.4rem; background: color-mix(in srgb, var(--papier) 94%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--ligne); }
.etat-sauvegarde { color: var(--gris); font-size: .88rem; }
.etat-sauvegarde.sale { color: #9a6b00; }
.editeur-actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.editeur-grille { display: grid; grid-template-columns: minmax(0, 1fr) 330px; align-items: start; }
.editeur-texte { padding: 2.4rem 2.5rem 4rem; max-width: 860px; width: 100%; margin: 0 auto; }
.admin .champ-titre {
  border: 0; background: transparent; resize: none; overflow: hidden; padding: 0; width: 100%;
  font: 650 clamp(1.9rem, 3vw, 2.6rem)/1.15 var(--titres); color: var(--foret); letter-spacing: -.01em;
}
.admin .champ-chapo { border: 0; background: transparent; resize: none; overflow: hidden; padding: 0; margin-top: .9rem; font-size: 1.2rem; line-height: 1.55; color: var(--gris); }
.admin .champ-titre:focus, .admin .champ-chapo:focus { outline: none; }
.champ-titre::placeholder, .champ-chapo::placeholder { color: color-mix(in srgb, var(--gris) 55%, transparent); }
.barre-outils {
  position: sticky; top: 58px; z-index: 10; margin: 1.6rem 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: .35rem; background: var(--papier); border: 1px solid var(--ligne); border-radius: 12px; box-shadow: 0 4px 14px rgba(23, 61, 42, .06);
}
.barre-outils button { font: inherit; min-width: 34px; height: 34px; padding: 0 .45rem; border: 0; border-radius: 7px; background: none; color: var(--encre); cursor: pointer; font-size: .98rem; }
.barre-outils button:hover { background: var(--creme); }
.barre-outils button.actif { background: color-mix(in srgb, var(--pousse) 28%, transparent); color: var(--vert-fonce); }
.barre-outils button mark { padding: 0 .15em; }
.admin .barre-outils select { width: auto; border: 0; background: var(--creme); font-weight: 600; font-size: .9rem; padding: .4rem .5rem; margin-right: .2rem; }
.barre-outils .sep { width: 1px; height: 22px; background: var(--ligne); margin: 0 .3rem; }
.zone-edition { min-height: 50vh; padding: 1.6rem .2rem 2rem; outline: none; }
.zone-edition:empty::before, .zone-collage:empty::before { content: attr(data-placeholder); color: color-mix(in srgb, var(--gris) 65%, transparent); font-style: italic; }
.zone-edition img { cursor: default; }
.zone-edition img:hover { outline: 3px solid color-mix(in srgb, var(--pousse) 60%, transparent); }
.zone-edition figcaption:empty::before { content: "Légende…"; color: var(--gris); }
.zone-edition table { display: table; }
.aide-bas { color: var(--gris); font-size: .85rem; border-top: 1px solid var(--ligne); padding-top: .8rem; }

.editeur-panneau { position: sticky; top: 58px; max-height: calc(100vh - 58px); overflow-y: auto; border-left: 1px solid var(--ligne); background: color-mix(in srgb, var(--papier) 55%, var(--creme)); padding: 1rem; display: grid; gap: .8rem; }
.bloc-panneau { background: var(--papier); border: 1px solid var(--ligne); border-radius: 12px; padding: .9rem; display: grid; gap: .7rem; }
.bloc-panneau h3 { margin: 0; font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--gris); }
.statut-ligne { margin: 0; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; font-size: .93rem; }
.couverture { border-radius: 10px; overflow: hidden; position: relative; }
.couverture img { width: 100%; aspect-ratio: 16/10; object-fit: cover; }
.couverture-actions { position: absolute; right: .5rem; bottom: .5rem; display: flex; gap: .3rem; }
.depot { width: 100%; display: grid; place-items: center; gap: .3rem; aspect-ratio: 16/9; border: 2px dashed var(--ligne); border-radius: 10px; background: var(--creme); color: var(--gris); font: inherit; font-size: .9rem; cursor: pointer; text-align: center; }
.depot span { font-size: 1.8rem; }
.depot:hover, .depot.survol { border-color: var(--vert); color: var(--vert-fonce); }
.depot.envoi { opacity: .6; pointer-events: none; }
.depot.grand { aspect-ratio: auto; padding: 2.4rem 1rem; }
.liste-sources { display: grid; gap: .5rem; }
.source { display: grid; grid-template-columns: 20px 1fr auto; gap: .4rem; align-items: start; }
.source .num { font-weight: 700; color: var(--gris); font-size: .85rem; padding-top: .5rem; text-align: right; }
.source-champs { display: grid; gap: 2px; }
.source-champs .champ { padding: .4rem .55rem; font-size: .85rem; border-radius: 6px; }
.source-champs .champ:first-child { font-weight: 600; }
.source-btns { display: grid; gap: 2px; }
.source-btns button { border: 0; background: var(--creme); border-radius: 5px; width: 24px; height: 24px; cursor: pointer; color: var(--gris); font-size: .9rem; }
.source-btns button:hover:not(:disabled) { color: var(--vert-fonce); }
.source-btns button:disabled { opacity: .35; }
.sources-actions { display: flex; gap: .3rem; flex-wrap: wrap; }
.compte-sources { font-weight: 600; color: var(--vert); letter-spacing: 0; }
.vide-petit { margin: 0; color: var(--gris); font-size: .86rem; }
.slug { display: flex; align-items: center; gap: .2rem; font-size: .85rem; color: var(--gris); }
.slug .champ { font-size: .85rem; padding: .4rem .5rem; }

/* ---------- Fenêtres ---------- */
.fenetre-fond { position: fixed; inset: 0; z-index: 50; background: rgba(12, 28, 19, .55); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 1rem; animation: apparait .15s ease; }
.fenetre { width: min(560px, 100%); max-height: calc(100vh - 2rem); overflow-y: auto; background: var(--papier); border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); padding: 1.6rem; display: grid; gap: 1rem; }
.fenetre-large { width: min(860px, 100%); }
.fenetre h2 { margin: 0; font-family: var(--titres); color: var(--foret); font-weight: 600; }
.fenetre .intro { margin: -.4rem 0 0; color: var(--gris); }
.fenetre-actions { display: flex; justify-content: flex-end; gap: .5rem; }
.zone-collage { min-height: 220px; max-height: 42vh; overflow-y: auto; border: 2px dashed color-mix(in srgb, var(--pousse) 60%, var(--ligne)); border-radius: 12px; padding: 1.2rem 1.4rem; background: var(--creme); font-size: 1rem; outline: none; }
.zone-collage:focus { border-color: var(--vert); }
.zone-collage.rempli { border-style: solid; background: var(--papier); }
.zone-collage img { max-height: 180px; width: auto; margin: .6rem 0; }
.resume-import { display: grid; gap: .45rem; background: color-mix(in srgb, var(--pousse) 12%, var(--papier)); border-radius: 10px; padding: .8rem 1rem; font-size: .93rem; }
.resume-import .etiq { display: inline-block; min-width: 4.5rem; font-weight: 700; color: var(--vert-fonce); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.resume-import .chiffres { display: flex; gap: 1.2rem; flex-wrap: wrap; font-weight: 600; color: var(--foret); }
.options-import { border: 0; padding: 0; margin: 0; display: grid; gap: .4rem; }
.onglets-fenetre { justify-self: start; }
.biblio { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; max-height: 300px; overflow-y: auto; }
.biblio button { border: 2px solid transparent; padding: 0; border-radius: 8px; overflow: hidden; cursor: pointer; aspect-ratio: 1; background: var(--creme); }
.biblio button.choisi { border-color: var(--vert); }
.biblio img { width: 100%; height: 100%; object-fit: cover; }
.apercu-choix img { max-height: 200px; border-radius: 10px; margin: 0 auto; }
.aide { color: var(--gris); font-size: .85rem; margin: .4rem 0 0; }

/* ---------- Rubriques, compte ---------- */
.ajout-rubrique { display: flex; gap: .5rem; max-width: 560px; margin-bottom: 1.2rem; }
.liste-rubriques { display: grid; gap: .5rem; max-width: 980px; }
.rubrique { display: grid; grid-template-columns: auto 1fr auto auto auto; gap: .8rem; align-items: center; background: var(--papier); padding: .7rem .9rem; border-radius: 12px; }
.rubrique-champs { display: grid; grid-template-columns: 220px 1fr; gap: .5rem; }
.rubrique-ordre { display: grid; gap: 2px; }
.rubrique-ordre button { border: 0; background: var(--creme); border-radius: 5px; width: 26px; height: 22px; cursor: pointer; color: var(--gris); }
.rubrique-ordre button:disabled { opacity: .35; }
.rubrique .nb { color: var(--gris); font-size: .85rem; white-space: nowrap; }
.carte-form { max-width: 460px; background: var(--papier); border-radius: 14px; padding: 1.4rem; display: grid; gap: .9rem; }
.carte-form h3 { margin: 0; font-family: var(--titres); color: var(--foret); }

/* ---------- Notifications ---------- */
#notifications { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 80; display: grid; gap: .5rem; justify-items: end; }
.notif { background: #10291c; color: #eaf5e6; padding: .7rem 1.1rem; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); font-weight: 600; font-size: .93rem; max-width: 420px; animation: apparait .2s ease; transition: opacity .35s, transform .35s; border-left: 4px solid var(--pousse); }
.notif-erreur { border-left-color: #e5534b; }
.notif-alerte { border-left-color: #e8b33a; }
.notif-info { border-left-color: var(--eau); }
.notif.sortie { opacity: 0; transform: translateY(8px); }
@keyframes apparait { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Écrans étroits ---------- */
@media (max-width: 1100px) {
  .editeur-grille { grid-template-columns: 1fr; }
  .editeur-panneau { position: static; max-height: none; border-left: 0; border-top: 1px solid var(--ligne); grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}
@media (max-width: 820px) {
  .admin-cadre { grid-template-columns: 1fr; }
  .admin-barre { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .8rem; padding: .7rem; }
  .admin-barre nav { display: flex; flex-wrap: wrap; }
  .admin-barre-bas { margin: 0 0 0 auto; display: flex; }
  .admin-principal { padding: 1.2rem; }
  .editeur-texte { padding: 1.4rem 1.1rem 3rem; }
  .editeur-tete { flex-wrap: wrap; padding: .6rem .8rem; }
  .barre-outils { top: 0; }
  .ligne-article { grid-template-columns: 70px 1fr; }
  .vignette { width: 70px; }
  .ligne-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .rubrique { grid-template-columns: 1fr; }
  .rubrique-champs { grid-template-columns: 1fr; }
}
