/* Admin — sobre et aéré : fond gris très clair, cartes à bordure fine,
   une seule couleur d'accent ; les couleurs vives sont réservées aux états. */
:root { --adm-accent: #2563eb; --adm-bg: #f6f7f9; --adm-card: #fff; --adm-line: #e5e7eb; --adm-sidebar: 15rem; }
[data-bs-theme="dark"] { --adm-bg: #0b1220; --adm-card: #111a2e; --adm-line: #243049; }

.adm-body { background: var(--adm-bg); }
.adm-shell { display: flex; min-height: 100vh; }

/* Sidebar */
.adm-sidebar { width: var(--adm-sidebar); flex: none; background: var(--adm-card); border-right: 1px solid var(--adm-line); }
@media (min-width: 992px) { .adm-sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; } }
.adm-brand { display: flex; align-items: center; padding: 1rem 1.25rem; color: var(--bs-emphasis-color); }
.adm-brand a { color: inherit; }
.adm-nav { padding: 0 .75rem 1rem; }
.adm-nav-group { margin: 1.25rem .5rem .35rem; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--bs-secondary-color); }
.adm-nav-link { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; border-radius: .5rem; color: var(--bs-body-color); text-decoration: none; font-size: .9rem; }
.adm-nav-link:hover { background: var(--bs-tertiary-bg); }
.adm-nav-link.active { background: color-mix(in srgb, var(--adm-accent) 12%, transparent); color: var(--adm-accent); font-weight: 600; }
.adm-nav-icon { width: 1.1rem; display: inline-flex; align-items: center; justify-content: center; opacity: .8; }
.adm-nav-icon svg { width: 1.1rem; height: 1.1rem; display: block; }

/* Zone principale */
.adm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.adm-topbar { display: flex; align-items: center; gap: .75rem; padding: .75rem 1.5rem; background: var(--adm-card); border-bottom: 1px solid var(--adm-line); position: sticky; top: 0; z-index: 10; }
.adm-title { font-size: 1.1rem; font-weight: 600; margin: 0; }
.adm-content { flex: 1; padding: 1.5rem; max-width: 80rem; width: 100%; margin: 0 auto; }
.adm-footer { text-align: center; padding: 1rem; font-size: .8rem; color: var(--bs-secondary-color); }

/* Cartes et tableaux des pages existantes, harmonisés */
.adm-content .card, .adm-card { background: var(--adm-card); border: 1px solid var(--adm-line); border-radius: .75rem; box-shadow: none; }
.adm-content .table { --bs-table-bg: transparent; }
.adm-content .table > :not(caption) > * > * { padding: .7rem .75rem; }
.adm-content .table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--bs-secondary-color); border-bottom-color: var(--adm-line); }
.adm-content .btn { border-radius: .5rem; }

/* Dashboard */
.adm-kpi { padding: 1.1rem 1.25rem; height: 100%; display: block; color: inherit; text-decoration: none; }
.adm-kpi:hover { border-color: var(--adm-accent); }
.adm-kpi-label { font-size: .8rem; color: var(--bs-secondary-color); }
.adm-kpi-value { font-size: 1.9rem; font-weight: 700; line-height: 1.2; color: var(--bs-emphasis-color); }
.adm-kpi-delta { font-size: .78rem; color: var(--bs-secondary-color); }
.adm-kpi-delta.up { color: #16a34a; }
.adm-kpi-delta.down { color: #dc2626; }
.adm-section-title { font-size: .85rem; font-weight: 600; margin: 0 0 .75rem; }
.adm-todo { display: flex; align-items: center; justify-content: space-between; padding: .6rem 0; border-bottom: 1px solid var(--adm-line); color: inherit; text-decoration: none; font-size: .9rem; }
.adm-todo:last-child { border-bottom: 0; }
.adm-pill { min-width: 1.6rem; text-align: center; border-radius: 999px; padding: .1rem .5rem; font-size: .75rem; font-weight: 600; background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); }
.adm-pill.warn { background: #fef3c7; color: #92400e; }
[data-bs-theme="dark"] .adm-pill.warn { background: #422006; color: #fde68a; }
.adm-chart { width: 100%; height: 11rem; }
.adm-chart .grid { stroke: var(--adm-line); stroke-width: 1; }
.adm-legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .8rem; color: var(--bs-secondary-color); }
.adm-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 999px; margin-right: .35rem; }
.adm-empty { text-align: center; padding: 1.5rem; color: var(--bs-secondary-color); font-size: .9rem; }

/* Pastilles « subtiles » (absentes de Bootstrap : text-bg-*-subtle). */
.text-bg-primary-subtle { background-color: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); }
.text-bg-secondary-subtle { background-color: var(--bs-secondary-bg-subtle); color: var(--bs-secondary-text-emphasis); }
.text-bg-success-subtle { background-color: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.text-bg-danger-subtle { background-color: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.text-bg-warning-subtle { background-color: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); }
.text-bg-info-subtle { background-color: var(--bs-info-bg-subtle); color: var(--bs-info-text-emphasis); }

/* En-tête de page : titre à gauche, actions à droite */
.adm-pagehead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.adm-pagehead-title { font-size: 1.25rem; font-weight: 600; margin: 0; }
.adm-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.adm-actions .btn { margin: 0 !important; }

/* Tableaux */
.adm-table { --bs-table-hover-bg: var(--bs-tertiary-bg); }
.adm-table th[data-sortable] { cursor: pointer; user-select: none; white-space: nowrap; }
.adm-table th[data-sortable]:hover { color: var(--bs-emphasis-color); }
.adm-table th[aria-sort="ascending"]::after { content: " ▲"; font-size: .65em; }
.adm-table th[aria-sort="descending"]::after { content: " ▼"; font-size: .65em; }
.adm-table tbody tr:last-child td, .adm-table tbody tr:last-child th { border-bottom: 0; }
.adm-tools { padding: .75rem; border-bottom: 1px solid var(--adm-line); }
.adm-tools input { max-width: 18rem; }

/* Formulaires et cartes */
.adm-content .card-header { text-align: left !important; background: transparent; border-bottom: 1px solid var(--adm-line); font-size: 1rem !important; padding: 1rem 1.25rem !important; }
.adm-content .card-body { padding: 1.25rem; }
.adm-content .form-label { font-size: .85rem; font-weight: 500; color: var(--bs-secondary-color); margin-bottom: .3rem; }
.adm-content .form-control, .adm-content .form-select { border-radius: .5rem; border-color: var(--adm-line); background-color: var(--adm-card); }
.adm-content .form-control:focus, .adm-content .form-select:focus { border-color: var(--adm-accent); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--adm-accent) 18%, transparent); }
.adm-content .text-danger:not(.btn):not(.dropdown-item) { font-size: .8rem; }
.adm-content .alert { border-radius: .75rem; }
.adm-content .pagination { justify-content: center; margin-bottom: 0; }
.adm-content hr { border-color: var(--adm-line); opacity: 1; }
.adm-content .dropdown-menu { border-radius: .6rem; border-color: var(--adm-line); box-shadow: 0 .5rem 1.5rem rgba(15,23,42,.12); }

/* Recherche serveur */
.adm-search { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.adm-search input { max-width: 20rem; }

/* Éditeur Markdown (centre d'aide) */
.mde-tabs { margin-bottom: 0; }
.mde-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; padding: .5rem; border: 1px solid var(--adm-line); border-top: 0; background: var(--adm-card); }
.mde-sep { width: 1px; align-self: stretch; background: var(--adm-line); margin: 0 .25rem; }
.mde-textarea { border-top-left-radius: 0; border-top-right-radius: 0; resize: vertical; }
.mde-preview { min-height: 12rem; padding: 1rem; border: 1px solid var(--adm-line); border-top: 0; border-radius: 0 0 .5rem .5rem; overflow-x: auto; line-height: 1.7; }
.mde-preview img { max-width: 100%; height: auto; border: 1px solid var(--adm-line); border-radius: .5rem; }
.mde-preview pre { background: #0f172a; color: #e2e8f0; padding: 1rem; border-radius: .5rem; }
.mde-preview table { width: 100%; margin-bottom: 1rem; }
.mde-preview th, .mde-preview td { border: 1px solid var(--adm-line); padding: .4rem .6rem; }
.mde-modal { width: min(900px, 94vw); max-height: 88vh; padding: 0; border: 1px solid var(--adm-line); border-radius: .75rem; background: var(--adm-card); color: inherit; }
.mde-modal::backdrop { background: rgba(15, 23, 42, .55); }
.mde-modal[open] { display: flex; flex-direction: column; }
.mde-modal-head { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-bottom: 1px solid var(--adm-line); }
.mde-modal-head input { flex: 1; }
.mde-modal-crumbs { padding: .5rem 1rem 0; }
.mde-modal-body { padding: 1rem; overflow-y: auto; }
.mde-folder { display: flex; align-items: center; justify-content: center; height: 80px; color: #2563eb; border: 1px solid var(--adm-line); border-radius: .375rem; }
.mde-grid { display: flex; flex-wrap: wrap; gap: .75rem; }
.mde-thumb { width: 120px; text-align: center; font-size: .75rem; }
.mde-thumb img { width: 100%; height: 80px; object-fit: cover; border: 1px solid var(--adm-line); border-radius: .375rem; }
.mde-thumb .badge { font-weight: 500; }

/* Zone de dépôt de fichier (partial admin/partials/dropzone) */
.dz { position: relative; border: 2px dashed var(--adm-line); border-radius: .5rem; background: transparent; transition: border-color .15s, background-color .15s; }
.dz:hover, .dz.is-over { border-color: #2563eb; background: rgba(37, 99, 235, .06); }
.dz-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 1; }
.dz-body { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: 1.25rem 1rem; text-align: center; color: var(--bs-secondary-color, #6c757d); pointer-events: none; }
.dz-preview { max-height: 96px; max-width: 100%; width: auto; border: 1px solid var(--adm-line); border-radius: .375rem; padding: .25rem; }
.dz-file { font-size: .85rem; word-break: break-all; }
.dz-file:empty { display: none; }

/* Image en grand (liens [data-lightbox]) */
.lb-modal { width: min(1000px, 94vw); max-height: 92vh; padding: 0; border: 1px solid var(--adm-line); border-radius: .75rem; background: var(--adm-card); color: inherit; }
.lb-modal::backdrop { background: rgba(15, 23, 42, .65); }
.lb-modal[open] { display: flex; flex-direction: column; }
.lb-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; border-bottom: 1px solid var(--adm-line); }
.lb-body { padding: 1rem; overflow: auto; text-align: center; background: repeating-conic-gradient(#e5e7eb 0% 25%, #fff 0% 50%) 50% / 16px 16px; }
.lb-body img { max-width: 100%; max-height: 76vh; width: auto; height: auto; }
