/* =====================================================================
   Interface d'administration — claire, lisible, gros boutons.
   ===================================================================== */
:root {
  --rose: #ecc9c4;
  --rose-clair: #f8ecea;
  --rose-texte: #8a4b52;
  --anthracite: #2d3035;
  --anthracite-2: #3c4047;
  --gris: #62666d;
  --gris-bord: #e3dfde;
  --fond: #f6f3f2;
  --blanc: #fff;
  --vert: #1f7a4d; --vert-fond: #e3f4ea;
  --ambre: #8a5a00; --ambre-fond: #fff1d6;
  --rouge: #b3261e; --rouge-fond: #fdecea;
  --bleu: #2f5d8a; --bleu-fond: #e5eef8;
  --rayon: 14px;
  --ombre: 0 1px 2px rgba(45, 48, 53, 0.06), 0 8px 24px -14px rgba(45, 48, 53, 0.25);
  --police: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--police); font-size: 1rem; line-height: 1.55; color: var(--anthracite); background: var(--fond); }
a { color: var(--rose-texte); }
h1, h2 { line-height: 1.25; margin: 0 0 0.4em; }
p { margin: 0 0 0.8em; }
ul { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 3px solid #c48b88; outline-offset: 2px; }
main:focus { outline: none; }
small { font-size: 0.85em; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.icone { width: 1.2em; height: 1.2em; flex-shrink: 0; vertical-align: -0.22em; }
.texte-doux { color: var(--gris); }
.lien-evitement { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--anthracite); color: #fff; padding: 10px 16px; border-radius: 8px; }
.lien-evitement:focus { top: 12px; }

/* ---------- Cadre : barre latérale + contenu ---------- */
.admin__cadre { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.barre { background: var(--anthracite); color: #e9e6e5; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.barre__haut { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.barre__logo { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.barre__logo strong { display: block; font-family: 'Playfair Display', Georgia, serif; font-size: 1.05rem; }
.barre__logo small { color: var(--rose); letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.7rem; font-weight: 700; }
.barre__pastille { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--rose); color: var(--anthracite); flex-shrink: 0; }
.barre__burger { display: none; background: none; border: 0; color: #fff; width: 44px; height: 44px; cursor: pointer; }
.barre__burger .icone { width: 26px; height: 26px; }
.barre__nav { flex: 1; display: flex; flex-direction: column; justify-content: space-between; padding: 16px 12px; overflow-y: auto; }
.barre__lien {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 10px;
  color: #d9d5d4; text-decoration: none; font: 500 1rem var(--police); background: none; border: 0; cursor: pointer; text-align: left;
  transition: background 0.2s, color 0.2s;
}
.barre__lien:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.barre__lien[aria-current='page'] { background: var(--rose); color: var(--anthracite); font-weight: 700; }
.barre__compteur { margin-left: auto; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: #e0a43a; color: #2d2100; font-size: 0.8rem; font-weight: 700; display: grid; place-items: center; }
.barre__bas { border-top: 1px solid rgba(255, 255, 255, 0.08); padding-top: 12px; margin-top: 12px; }
.barre__bas form { margin: 0; }

.admin__contenu { padding: 36px clamp(16px, 4vw, 48px) 64px; min-width: 0; max-width: 1400px; }

/* ---------- En-tête de page ---------- */
.page-entete { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.page-entete h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin: 0; }
.page-entete__sous-titre { color: var(--gris); margin: 6px 0 0; }
.fil { margin-bottom: 12px; }
.fil a { text-decoration: none; font-weight: 600; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px;
  border-radius: 10px; border: 1.5px solid transparent; font: 600 1rem/1.2 var(--police); cursor: pointer;
  text-decoration: none; transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.1s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--grand { padding: 14px 24px; font-size: 1.05rem; }
.btn--petit { padding: 7px 12px; font-size: 0.9rem; border-radius: 8px; }
.btn--plein { width: 100%; }
.btn--principal { background: var(--anthracite); color: #fff; }
.btn--principal:hover { background: var(--anthracite-2); box-shadow: var(--ombre); }
.btn--secondaire { background: var(--blanc); color: var(--anthracite); border-color: var(--gris-bord); }
.btn--secondaire:hover { border-color: var(--anthracite); }
.btn--danger { background: var(--rouge); color: #fff; }
.btn--danger:hover { background: #8f1d17; }
.btn--danger-doux { background: var(--blanc); color: var(--rouge); border-color: #f1c4c0; }
.btn--danger-doux:hover { background: var(--rouge-fond); border-color: var(--rouge); }
.btn--lien { background: none; color: var(--gris); text-decoration: underline; }
.btn--statut-confirme { background: var(--vert); color: #fff; }
.btn--statut-termine { background: var(--bleu); color: #fff; }
.btn--statut-en_attente { background: var(--ambre-fond); color: var(--ambre); border-color: #f0d49a; }
.btn--statut-annule { background: var(--blanc); color: var(--rouge); border-color: #f1c4c0; }
.btn-icone { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 1.5px solid var(--gris-bord); background: var(--blanc); color: var(--anthracite); cursor: pointer; }
.btn-icone:hover:not(:disabled) { border-color: var(--anthracite); }
.btn-icone:disabled { opacity: 0.3; cursor: default; }
.js .js-masque { display: none; }

/* ---------- Badges de statut ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 700; white-space: nowrap; }
.badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge--en_attente { background: var(--ambre-fond); color: var(--ambre); }
.badge--confirme { background: var(--vert-fond); color: var(--vert); }
.badge--annule { background: var(--rouge-fond); color: var(--rouge); }
.badge--termine { background: var(--bleu-fond); color: var(--bleu); }
.badge--masque { background: #ecebea; color: var(--gris); }

/* ---------- Messages flash ---------- */
.flash { display: flex; align-items: flex-start; gap: 12px; padding: 14px 18px; border-radius: var(--rayon); margin-bottom: 24px; font-weight: 600; animation: glisse 0.35s ease-out; }
.flash p { margin: 0; flex: 1; }
.flash .icone { margin-top: 2px; }
.flash--succes { background: var(--vert-fond); color: #145136; border: 1px solid #b9e2cb; }
.flash--erreur { background: var(--rouge-fond); color: #7a1912; border: 1px solid #f1c4c0; }
.flash__fermer { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; opacity: 0.7; }
@keyframes glisse { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- Panneaux ---------- */
.panneau { background: var(--blanc); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 24px; margin: 0 0 24px; border: 0; min-width: 0; }
fieldset.panneau { padding-top: 20px; }
.panneau--sans-marge { padding: 0; overflow: hidden; }
.panneau__titre { font-size: 1.2rem; margin-bottom: 16px; padding: 0; float: none; width: 100%; }
.panneau__titre small { color: var(--gris); font-weight: 500; }
.panneau__titre--bande { padding: 18px 24px; margin: 0; background: var(--rose-clair); }
.panneau--danger { border: 1.5px solid #f1c4c0; }
.vide { color: var(--gris); text-align: center; padding: 24px; }
.aide { color: var(--gris); font-size: 0.9rem; margin: 6px 0 0; }

/* ---------- Tableau de bord ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 28px; }
.stat { position: relative; background: var(--blanc); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 22px; display: flex; flex-direction: column; gap: 4px; }
.stat__icone { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--fond); margin-bottom: 8px; }
.stat__nombre { font-size: 2.4rem; font-weight: 700; line-height: 1; }
.stat__libelle { color: var(--gris); }
.stat__lien { margin-top: 8px; font-weight: 600; font-size: 0.92rem; }
.stat--rose { background: var(--rose); }
.stat--rose .stat__icone { background: rgba(255, 255, 255, 0.55); }
.stat--rose .stat__libelle, .stat--rose .stat__lien { color: var(--anthracite); }
.stat--alerte { box-shadow: inset 0 0 0 2px #e0a43a, var(--ombre); }
.stat--alerte .stat__icone { background: var(--ambre-fond); color: var(--ambre); }
.prochains li + li { border-top: 1px solid var(--gris-bord); }
.prochain { display: grid; grid-template-columns: 170px 1fr auto; align-items: center; gap: 16px; padding: 14px 8px; color: inherit; text-decoration: none; border-radius: 10px; }
.prochain:hover { background: var(--fond); }
.prochain__date, .prochain__infos { display: flex; flex-direction: column; }
.prochain__date strong { text-transform: capitalize; }
.prochain__date span, .prochain__infos span { color: var(--gris); font-size: 0.93rem; }
.raccourcis { display: flex; flex-wrap: wrap; gap: 12px; }
.raccourci { display: inline-flex; align-items: center; gap: 10px; padding: 14px 18px; background: var(--blanc); border-radius: 12px; box-shadow: var(--ombre); color: var(--anthracite); text-decoration: none; font-weight: 600; }
.raccourci:hover { box-shadow: inset 0 0 0 2px var(--rose), var(--ombre); }

/* ---------- Onglets & filtres ---------- */
.onglets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; background: var(--blanc); padding: 6px; border-radius: 12px; box-shadow: var(--ombre); width: fit-content; max-width: 100%; }
.onglet { padding: 10px 18px; border-radius: 8px; color: var(--anthracite); text-decoration: none; font-weight: 600; }
.onglet:hover { background: var(--fond); }
.onglet[aria-current='page'] { background: var(--anthracite); color: #fff; }
.filtres { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 16px; align-items: end; background: var(--blanc); padding: 18px 20px; border-radius: var(--rayon); box-shadow: var(--ombre); margin-bottom: 24px; }
.filtres .champ { margin: 0; }
.filtres__actions { display: flex; gap: 8px; align-items: center; }
.recherche { position: relative; }
.recherche .icone { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--gris); }
.recherche input { padding-left: 44px !important; }

/* ---------- Tableaux ---------- */
.tableau-cadre { background: var(--blanc); border-radius: var(--rayon); box-shadow: var(--ombre); overflow-x: auto; }
.tableau-cadre--nu { box-shadow: none; border-radius: 0; }
.tableau { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.tableau th, .tableau td { padding: 14px 16px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--gris-bord); }
.tableau thead th { background: #faf8f7; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gris); font-weight: 700; white-space: nowrap; }
.tableau tbody tr:hover { background: #fcfaf9; }
.tableau tbody tr:last-child td, .tableau tbody tr:last-child th { border-bottom: 0; }
.tableau small { color: var(--gris); }
.tableau .est-passe { color: var(--gris); }
.tableau .est-aujourdhui { background: #fff9f8; box-shadow: inset 4px 0 0 var(--rose); }
.tableau .est-masque td { opacity: 0.6; }
.tableau .est-masque td.cellule-actions { opacity: 1; }
.cellule-message { max-width: 240px; color: var(--gris); }
.tableau--rdv th, .tableau--rdv td { padding: 12px 10px; }
.tableau--rdv .cellule-message { max-width: 190px; font-size: 0.9rem; }
.contact-client { display: flex; flex-direction: column; gap: 2px; font-size: 0.9rem; }
.contact-client a { white-space: nowrap; }
.nowrap { white-space: nowrap; }
.cellule-actions { white-space: nowrap; text-align: right !important; }
.cellule-actions, .cellule-ordre { display: table-cell; }
.cellule-actions form, .cellule-ordre form { display: inline-block; margin: 0 2px; }
.cellule-ordre { white-space: nowrap; }
.form-statut { display: flex; gap: 6px; margin: 0; }
.select-statut { font: 700 0.88rem var(--police); padding: 6px 30px 6px 12px; border-radius: 999px; border: 1.5px solid transparent; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.select-statut--en_attente { background-color: var(--ambre-fond); color: var(--ambre); }
.select-statut--confirme { background-color: var(--vert-fond); color: var(--vert); }
.select-statut--annule { background-color: var(--rouge-fond); color: var(--rouge); }
.select-statut--termine { background-color: var(--bleu-fond); color: var(--bleu); }
.etoiles { color: #d39b4a; letter-spacing: 2px; }
.etoiles__vides { color: #ddd; }

/* ---------- Formulaires ---------- */
.form-admin .champ, .filtres .champ { margin-bottom: 18px; }
.champ label { display: block; font-weight: 600; margin-bottom: 6px; }
.facultatif { font-weight: 400; color: var(--gris); }
.form-admin input[type='text'], .form-admin input[type='url'], .form-admin input[type='email'], .form-admin input[type='password'],
.form-admin input[type='number'], .form-admin input[type='time'], .form-admin select, .form-admin textarea,
.filtres input, .filtres select, .vignette input[type='text'] {
  width: 100%; font: inherit; color: var(--anthracite); padding: 12px 14px; min-height: 48px;
  border: 1.5px solid #d6d0cf; border-radius: 10px; background: var(--blanc); transition: border-color 0.2s, box-shadow 0.2s;
}
.form-admin textarea { resize: vertical; line-height: 1.55; }
.form-admin input:focus, .form-admin select:focus, .form-admin textarea:focus, .filtres input:focus, .filtres select:focus, .vignette input:focus {
  outline: none; border-color: #c48b88; box-shadow: 0 0 0 4px rgba(236, 201, 196, 0.55);
}
.form-admin :is(input, select, textarea)[aria-invalid='true'] { border-color: var(--rouge); background: #fffafa; }
.champ__erreur { color: var(--rouge); font-weight: 600; font-size: 0.92rem; margin: 6px 0 0; }
.champs-ligne { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.champ--case { display: flex; align-items: flex-start; gap: 12px; }
.champ--case input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--anthracite); flex-shrink: 0; }
.champ--case label { font-weight: 500; }
.champ-unite { display: flex; align-items: center; gap: 10px; }
.champ-unite span { font-weight: 700; color: var(--gris); }
.form-etroit { max-width: 760px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 8px; }
.barre-enregistrer { position: sticky; bottom: 0; z-index: 5; padding: 16px 0; margin-bottom: 24px; background: linear-gradient(0deg, var(--fond) 70%, transparent); }
.tableau--horaires input[type='time'] { min-height: 44px; max-width: 160px; }
.tableau--horaires th[scope='row'] { font-weight: 700; }

.interrupteur { position: relative; display: inline-flex; cursor: pointer; }
.interrupteur input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.interrupteur__piste { width: 52px; height: 30px; border-radius: 999px; background: #d6d0cf; position: relative; transition: background 0.2s; }
.interrupteur__piste::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.2s; }
.interrupteur input:checked + .interrupteur__piste { background: var(--vert); }
.interrupteur input:checked + .interrupteur__piste::after { transform: translateX(22px); }
.interrupteur input:focus-visible + .interrupteur__piste { outline: 3px solid #c48b88; outline-offset: 2px; }

/* ---------- Détail d'un RDV ---------- */
.grille-detail { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: start; }
.details div { display: grid; grid-template-columns: 180px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--gris-bord); }
.details div:last-child { border-bottom: 0; }
.details dt { color: var(--gris); }
.details dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.boutons-statut { display: grid; gap: 10px; margin-top: 14px; }
.boutons-statut form { margin: 0; }

/* ---------- Photos ---------- */
.galerie-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; margin-bottom: 20px; }
.vignette { position: relative; border: 1px solid var(--gris-bord); border-radius: 12px; overflow: hidden; background: var(--fond); display: flex; flex-direction: column; }
.vignette img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: linear-gradient(135deg, var(--rose), var(--anthracite)); }
.vignette__numero { position: absolute; top: 10px; left: 10px; background: var(--anthracite); color: #fff; font-weight: 700; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 0.9rem; }
.vignette__form { padding: 12px 12px 0; margin: 0; }
.vignette__form label { font-size: 0.82rem; font-weight: 600; color: var(--gris); display: block; margin-bottom: 4px; }
.vignette__ligne { display: flex; gap: 6px; }
.vignette__ligne input { min-height: 40px !important; padding: 8px 10px !important; font-size: 0.92rem !important; }
.vignette__actions { display: flex; align-items: center; gap: 6px; padding: 12px; margin-top: auto; }
.vignette__actions form { margin: 0; }
.vignette__actions form:last-child { margin-left: auto; }
.ajout-photo summary { list-style: none; width: fit-content; }
.ajout-photo summary::-webkit-details-marker { display: none; }
.ajout-photo[open] summary { margin-bottom: 18px; }
.ajout-photo form { background: var(--fond); border-radius: 12px; padding: 20px; }
input[type='file'] { font: inherit; padding: 10px; border: 1.5px dashed #c9c2c1; border-radius: 10px; width: 100%; background: var(--blanc); }

/* ---------- Page de connexion ---------- */
.connexion { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 10%, #fff 0, transparent 40%), linear-gradient(135deg, var(--rose) 0%, #d8a8a3 100%); }
.connexion__carte { width: 100%; max-width: 420px; background: var(--blanc); border-radius: 20px; padding: 40px 36px; box-shadow: 0 30px 60px -20px rgba(45, 48, 53, 0.4); text-align: center; }
.connexion__logo { margin: 0 auto 16px; width: 60px; height: 60px; }
.connexion__logo .icone { width: 28px; height: 28px; }
.connexion h1 { font-family: 'Playfair Display', Georgia, serif; font-size: 1.9rem; margin-bottom: 2px; }
.connexion__sous-titre { color: var(--gris); margin-bottom: 26px; }
.connexion .form-admin { text-align: left; }
.connexion .flash { text-align: left; }
.connexion__retour { margin: 20px 0 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .filtres { grid-template-columns: 1fr 1fr; }
  .filtres .champ--recherche { grid-column: 1 / -1; }
}
@media (max-width: 960px) {
  .admin__cadre { grid-template-columns: 1fr; }
  .barre { position: sticky; top: 0; z-index: 20; height: auto; }
  .barre__haut { padding: 12px 16px; }
  .barre__burger { display: grid; place-items: center; }
  .barre__nav { display: none; padding: 8px 12px 16px; }
  .barre__nav.est-ouvert { display: flex; }
  .grille-detail { grid-template-columns: 1fr; }
  .admin__contenu { padding-top: 24px; }

  /* Tableaux → cartes empilées sur mobile/tablette */
  .tableau thead { display: none; }
  .tableau, .tableau tbody, .tableau tr, .tableau td, .tableau th[scope='row'] { display: block; width: 100%; }
  .tableau tr { padding: 14px 16px; border-bottom: 8px solid var(--fond); }
  .tableau td, .tableau th[scope='row'] { border: 0; padding: 6px 0; }
  .tableau td[data-label] { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: center; }
  .tableau td[data-label]::before { content: attr(data-label); font-size: 0.8rem; font-weight: 700; color: var(--gris); text-transform: uppercase; letter-spacing: 0.04em; }
  .cellule-actions { text-align: left !important; white-space: normal; padding-top: 12px !important; display: flex !important; flex-wrap: wrap; gap: 6px; }
  .cellule-message { max-width: none; }
}
@media (max-width: 640px) {
  .champs-ligne, .filtres { grid-template-columns: 1fr; }
  .prochain { grid-template-columns: 1fr; gap: 6px; }
  .details div { grid-template-columns: 1fr; gap: 2px; }
  .page-entete .btn { width: 100%; }
  .onglets { width: 100%; }
  .onglet { flex: 1; text-align: center; padding: 10px 8px; }
}
