/* ==========================================================================
   CMS Locale — Back-office (espace rédaction)
   ========================================================================== */

:root {
    --accent:      #ea580c;
    --accent-dark: #c2410c;
    --ink:         #16181d;
    --muted:       #6b7280;
    --line:        #e6e8ec;
    --bg:          #f4f5f7;
    --sidebar:     #181b22;
    --sidebar-2:   #21252e;
    --green:       #1a8f4c;
    --green-bg:    #e6f5ec;
    --amber:       #b46a00;
    --amber-bg:    #fdf1dd;
    --radius:      10px;
    --shadow-sm:   0 1px 2px rgba(16,24,40,.05);
    --head-h:      77px;
    --font:        'Libre Franklin', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
code { background: #eef0f3; padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }

/* ============================ LOGIN ============================ */

.loginpage {
    min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background: radial-gradient(1200px 600px at 50% -10%, #2a2f3a 0%, #14161b 60%);
}
.loginbox {
    width: 100%; max-width: 380px;
    background: #fff; border-radius: 16px; padding: 36px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.loginbox__brand { text-align: center; margin-bottom: 22px; }
.loginbox__logo {
    display: inline-block; background: var(--accent); color: #fff;
    font-weight: 900; font-size: 30px; letter-spacing: -.02em;
    padding: 6px 16px; border-radius: 8px;
}
.loginbox__brand p { color: var(--muted); margin: 12px 0 0; font-weight: 600; font-size: 14px; }
.loginbox__form { display: grid; gap: 16px; margin-top: 8px; }
.loginbox__form label { display: grid; gap: 6px; }
.loginbox__form label span { font-size: 13px; font-weight: 600; color: var(--ink); }
.loginbox__form input {
    padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 15px;
}
.loginbox__form input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(234,88,12,.12); }
.loginbox__back { display: block; text-align: center; margin-top: 20px; color: var(--muted); font-size: 13px; font-weight: 600; }
.loginbox__back:hover { color: var(--accent); }

/* ============================ STRUCTURE ============================ */

.admin { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.adminbar {
    background: var(--sidebar); color: #b9bec9;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; padding: 20px 16px;
    /* La nav s'est enrichie (Analytics, Suivis…) : défilement interne pour que le bas
       (Mon profil, Nouvel article, Voir le site, compte) reste toujours accessible. */
    overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent;
}
.adminbar__foot { flex-shrink: 0; }
.adminbar__brand { display: block; padding: 6px 8px 18px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 16px; text-decoration: none; }
.adminbar__logo { display: inline-block; background: var(--accent); color: #fff; font-weight: 900; font-size: 22px; padding: 3px 11px; border-radius: 6px; letter-spacing: -.02em; }
/* Logo du site (variante fond sombre, comme le footer du front), à l'échelle de la barre latérale */
.adminbar__brand .brand { display: inline-flex; align-items: center; gap: 6px; }
.adminbar__brand .brand__box { display: inline-flex; align-items: center; background: var(--accent); padding: 3px 9px 5px; border-radius: 7px; }
.adminbar__brand .brand__word { font-weight: 900; font-size: 20px; letter-spacing: -.02em; line-height: 1; white-space: nowrap; }
.adminbar__brand .brand__word--info { color: #fff; }
.adminbar__brand .brand__word--radar { color: #fff; }
.adminbar__brand .brand__radar {
    position: relative; flex: 0 0 auto; margin-left: 2px;
    width: 30px; height: 30px; border-radius: 50%; overflow: hidden;
    border: 2.5px solid var(--accent);
    background:
        radial-gradient(circle at center, rgba(40,52,74,.55) 0 1.5px, transparent 1.9px),
        repeating-radial-gradient(circle at center, transparent 0 4.5px, rgba(40,52,74,.16) 4.5px 5px),
        radial-gradient(circle at center, #ffffff 0%, #eef0f3 100%);
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.adminbar__brand .brand__radar::before, .adminbar__brand .brand__radar::after { content: ""; position: absolute; background: rgba(40,52,74,.26); }
.adminbar__brand .brand__radar::before { left: 50%; top: 0; bottom: 0; width: 1px; transform: translateX(-.5px); }
.adminbar__brand .brand__radar::after { top: 50%; left: 0; right: 0; height: 1px; transform: translateY(-.5px); }
.adminbar__brand .brand__sweep {
    position: absolute; inset: 0; border-radius: 50%;
    background: conic-gradient(from 0deg, rgba(234,88,12,.85) 0deg, rgba(234,88,12,0) 78deg, transparent 360deg);
    animation: brand-sweep 3s linear infinite;
}
.adminbar__brand .brand__blip {
    position: absolute; top: 24%; left: 66%; width: 5px; height: 5px; border-radius: 50%;
    background: var(--accent);
    animation: brand-blip 2s infinite;
}
@keyframes brand-sweep { to { transform: rotate(360deg); } }
@keyframes brand-blip {
    0%   { box-shadow: 0 0 0 0 rgba(234,88,12,.5); }
    70%  { box-shadow: 0 0 0 6px rgba(234,88,12,0); }
    100% { box-shadow: 0 0 0 0 rgba(234,88,12,0); }
}
@media (prefers-reduced-motion: reduce) { .adminbar__brand .brand__sweep, .adminbar__brand .brand__blip { animation: none; } }
.adminbar__sub { display: block; margin-top: 8px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #6b7280; }

.adminbar__nav { display: flex; flex-direction: column; gap: 4px; }
.adminbar__link {
    display: flex; align-items: center; gap: 11px;
    padding: 11px 12px; border-radius: 8px;
    font-size: 14.5px; font-weight: 600; color: #c3c8d2;
    transition: background .15s, color .15s;
}
.adminbar__link .ico { font-size: 15px; width: 18px; text-align: center; }
.adminbar__link:hover { background: var(--sidebar-2); color: #fff; }
.adminbar__link.is-active { background: var(--accent); color: #fff; }
.adminbar__link--cta { margin-top: 10px; background: rgba(255,255,255,.06); color: #fff; justify-content: center; border: 1px dashed rgba(255,255,255,.18); }
.adminbar__link--cta:hover { background: rgba(255,255,255,.12); }

.adminbar__foot { margin-top: auto; padding-top: 16px; }
.adminbar__view { display: block; font-size: 13px; font-weight: 600; color: #9aa1ad; padding: 8px 12px; }
.adminbar__view:hover { color: #fff; }
.adminbar__user { display: flex; align-items: center; gap: 10px; padding: 12px; margin-top: 8px; background: var(--sidebar-2); border-radius: 10px; }
.adminbar__avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; }
.adminbar__name { font-size: 13.5px; font-weight: 700; color: #fff; }
.adminbar__logout { font-size: 12px; color: #9aa1ad; }
.adminbar__logout:hover { color: var(--accent); }

.adminmain { padding: 0; min-width: 0; }
.adminmain__head {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 24px 32px; background: #fff; border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 3px rgba(16,24,40,.04);
    position: sticky; top: 0; z-index: 10;
}
.adminmain__head h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.adminmain__body { padding: 28px 32px 56px; }

/* ============================ FLASH ============================ */

.flash { padding: 13px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; font-weight: 500; border: 1px solid; }
.flash--success { background: var(--green-bg); border-color: #b8e2c8; color: var(--green); }
.flash--error { background: #fdecec; border-color: #f4c4c4; color: #b91c1c; }

/* ============================ STATS ============================ */

.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 28px; }
.stats--4 { grid-template-columns: repeat(4, 1fr); }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; border-top: 3px solid var(--ink); box-shadow: var(--shadow-sm); transition: box-shadow .15s; }
.stat:hover { box-shadow: 0 2px 8px rgba(16,24,40,.08); }
.stat--green  { border-top-color: var(--green); }
.stat--amber  { border-top-color: var(--amber); }
.stat--accent { border-top-color: var(--accent); }
.stat__value { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat__label { color: var(--muted); font-size: 13px; font-weight: 600; margin-top: 8px; }
.stats-note { margin: 0 0 18px; color: var(--muted); font-size: 14px; }

/* ============================ PANELS ============================ */

.panels { display: grid; grid-template-columns: 1.7fr 1fr; gap: 20px; align-items: start; }
/* Variante empilée (Stats du jour) : chaque panneau prend toute la largeur — le tableau
   « Détail » (titres longs) était illisible en demi-colonne. */
.panels--stack { grid-template-columns: 1fr; }
.panels--stack .panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

/* Éditeur d'article : barre d'enregistrement collante (toujours visible en bas) + habillage TinyMCE */
.editor__savebar {
    grid-column: 1 / -1; position: sticky; bottom: 12px; z-index: 30;
    display: flex; align-items: center; justify-content: flex-end; gap: 12px;
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
    padding: 10px 14px; box-shadow: 0 10px 26px -12px rgba(20,22,27,.4);
}
.editor__savebar-status { color: var(--muted); font-size: 13.5px; margin-right: auto; }
.tox-tinymce { border-radius: 8px !important; border: 1px solid var(--line-strong) !important; }

/* L'attribut hidden doit toujours gagner (certains éléments ont un display explicite) */
[hidden] { display: none !important; }

/* Génération IA : sélecteur de type de contenu en cartes cliquables */
.gen-types { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.gen-type {
    position: relative; display: flex; flex-direction: column; gap: 3px; cursor: pointer;
    padding: 14px 14px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.gen-type:hover { border-color: var(--line-strong); }
.gen-type input { position: absolute; opacity: 0; pointer-events: none; }
.gen-type:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(234,88,12,.10); }
.gen-type__icon { font-size: 20px; line-height: 1; }
.gen-type__name { font-weight: 800; font-size: 14.5px; color: var(--ink, #16181d); }
.gen-type__sub { font-size: 12px; color: var(--muted); line-height: 1.35; }
@media (max-width: 700px) { .gen-types { grid-template-columns: 1fr; } }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.panel__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel__head h2 { margin: 0; font-size: 16px; font-weight: 800; }
.panel__link { font-size: 13px; font-weight: 700; color: var(--accent); }
.panel__empty { padding: 28px 20px; color: var(--muted); }
.panel__empty a { color: var(--accent); font-weight: 600; }
.panel--empty { padding: 40px; text-align: center; }
.panel--empty p { color: var(--muted); margin: 0 0 16px; }

/* ============================ TABLE ============================ */

.table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.table th { text-align: left; padding: 12px 20px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--line); background: #fafbfc; }
.table td { padding: 13px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #f5f6f8; }
.table__title { font-weight: 600; }
.table__title a:hover { color: var(--accent); }
.table__sub { font-size: 12.5px; font-weight: 400; color: var(--muted); margin-top: 3px; }
.table__muted { color: var(--muted); font-size: 13px; }
.table__edit { color: var(--accent); font-weight: 600; }
.table__actions { white-space: nowrap; text-align: right; }
.star { color: #e0a400; }

.lnk { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 6px; background: none; border: 0; cursor: pointer; font-family: inherit; }
.lnk:hover { color: var(--ink); }
.lnk--danger:hover { color: #d6182b; }
.inline-form { display: inline; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge--green { background: var(--green-bg); color: var(--green); }
.badge--amber { background: var(--amber-bg); color: var(--amber); }

.toplist { list-style: none; margin: 0; padding: 8px 0; counter-reset: t; }
.toplist li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 20px; border-bottom: 1px solid var(--line); counter-increment: t; }
.toplist li:last-child { border-bottom: 0; }
.toplist li::before { content: counter(t); font-weight: 800; color: var(--accent); width: 18px; }
.toplist a { font-weight: 600; font-size: 14px; flex: 1; }
.toplist a:hover { color: var(--accent); }
.toplist span { font-size: 12.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ============================ TOOLBAR ============================ */

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px; box-shadow: var(--shadow-sm); }
.tab { padding: 8px 14px; border-radius: 7px; font-size: 13.5px; font-weight: 700; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.tab span { background: var(--bg); border-radius: 999px; padding: 0 7px; font-size: 12px; }
.tab.is-active { background: var(--ink); color: #fff; }
.tab.is-active span { background: rgba(255,255,255,.2); color: #fff; }
.toolbar__search { display: flex; gap: 8px; }
.toolbar__search input { border: 1px solid var(--line); border-radius: 8px; padding: 9px 13px; font: inherit; font-size: 14px; min-width: 220px; }
.toolbar__search input:focus { outline: 0; border-color: var(--accent); }
.toolbar__search button { border: 0; background: var(--ink); color: #fff; border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.toolbar__search button:hover { background: #000; }

/* ============================ ÉDITEUR ============================ */

.editor { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.editor__main { display: grid; gap: 18px; }
.editor__side { display: grid; gap: 18px; position: sticky; top: calc(var(--head-h) + 12px); z-index: 5; }
.editor__box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.editor__box h3 { margin: 0 0 14px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.editor__actions { display: grid; gap: 8px; margin-top: 14px; }
.editor__thumb { width: 100%; border-radius: 8px; margin-bottom: 14px; aspect-ratio: 16/9; object-fit: cover; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field__label { font-size: 13px; font-weight: 700; }
.field__hint { font-weight: 400; color: var(--muted); font-size: 12px; }
p.field__hint { margin: 6px 0 0; }
.field__input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 11px 13px; font: inherit; font-size: 14.5px; background: #fff; }
.field__input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(234,88,12,.10); }
.field__input--xl { font-size: 22px; font-weight: 700; padding: 14px 16px; }
.field__input--editor { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 14px; line-height: 1.7; resize: vertical; }
.field__input--file { padding: 9px; background: #fafbfc; }
textarea.field__input { resize: vertical; }
select.field__input {
    -moz-appearance: none; appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}

.check { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; cursor: pointer; margin-top: 4px; }
.check input { margin-top: 3px; accent-color: var(--accent); }

/* ============================ BOUTONS ============================ */

.btn-admin { display: inline-block; cursor: pointer; border: 1px solid transparent; border-radius: 8px; padding: 11px 18px; font: inherit; font-size: 14px; font-weight: 700; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; text-align: center; }
.btn-admin--primary { background: var(--accent); color: #fff; }
.btn-admin--primary:hover { background: var(--accent-dark); }
.btn-admin--ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-admin--ghost:hover { border-color: var(--ink); }
.btn-admin--block { display: block; width: 100%; }
.btn-admin:active { transform: translateY(1px); }
.btn-admin:disabled, .btn-admin[disabled] { opacity: .55; cursor: not-allowed; }

/* ============================ RUBRIQUES ============================ */

.cats-layout { display: grid; grid-template-columns: 2.3fr 1fr; gap: 20px; align-items: start; }
.cats-layout .table td, .cats-layout .table th { padding-right: 10px; }
.cats-layout .table__title { min-width: 180px; }
.panel--form { padding: 0 0 20px; }
.stack { display: grid; gap: 0; padding: 18px 20px; }
.stack__actions { display: flex; gap: 10px; margin-top: 14px; }

/* ============================ ÉTATS FOCUS (clavier) ============================ */

.btn-admin:focus-visible, .lnk:focus-visible, .tab:focus-visible,
.panel__link:focus-visible, .toplist a:focus-visible, .table__edit:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px;
}
.adminbar__link:focus-visible, .adminbar__view:focus-visible, .adminbar__logout:focus-visible {
    outline: 2px solid #fff; outline-offset: 2px; border-radius: 6px;
}

/* Pastilles compteur de la navigation (extrait du CSS inline du header) */
.adminbar__count { margin-left: auto; min-width: 18px; text-align: center; border-radius: 999px; font-size: 11px; line-height: 18px; padding: 0 6px; font-weight: 800; }
.adminbar__count--alert { background: var(--accent); color: #fff; }
.adminbar__count--muted { background: var(--sidebar-2); color: #c3c8d2; }

/* ============================ RESPONSIVE / MOBILE ============================ */

/* Chrome mobile masqué en desktop (>=981px) : le rendu desktop reste strictement identique */
.adminmobilebar { display: none; }
.adminbackdrop  { display: none; }
.editor-savebar { display: none; }

/* Conteneur de tableau : pleine largeur ; le scroll horizontal est confiné au mobile (voir @media) */
.table-wrap { width: 100%; }

@media (max-width: 980px) {
    /* --- Ceinture anti-débordement horizontal global --- */
    html, body { max-width: 100%; overflow-x: hidden; }

    /* --- Une seule colonne : la sidebar sort du flux (tiroir), le contenu prend toute la largeur --- */
    .admin { grid-template-columns: 1fr; }
    .adminmain { min-width: 0; }

    /* --- Barre supérieure mobile (app-bar) --- */
    .adminmobilebar {
        display: flex; align-items: center; gap: 12px;
        position: sticky; top: 0; z-index: 60;
        height: 56px; padding: 0 10px 0 6px;
        background: var(--sidebar); color: #fff;
        border-bottom: 1px solid rgba(255,255,255,.08);
    }
    .adminmobilebar__toggle {
        flex: 0 0 auto; width: 44px; height: 44px;
        display: grid; place-items: center;
        background: none; border: 0; cursor: pointer; border-radius: 8px;
    }
    .adminmobilebar__toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
    .adminmobilebar__bars,
    .adminmobilebar__bars::before,
    .adminmobilebar__bars::after {
        content: ""; display: block; width: 21px; height: 2px; border-radius: 2px;
        background: #e8eaef; transition: transform .2s ease, opacity .2s ease, background .2s ease;
    }
    .adminmobilebar__bars { position: relative; }
    .adminmobilebar__bars::before { position: absolute; left: 0; top: -6px; }
    .adminmobilebar__bars::after  { position: absolute; left: 0; top: 6px; }
    body.nav-open .adminmobilebar__bars { background: transparent; }
    body.nav-open .adminmobilebar__bars::before { transform: translateY(6px) rotate(45deg); }
    body.nav-open .adminmobilebar__bars::after  { transform: translateY(-6px) rotate(-45deg); }
    .adminmobilebar__logo {
        flex: 0 0 auto; background: var(--accent); color: #fff;
        font-weight: 900; font-size: 16px; letter-spacing: -.02em;
        padding: 3px 9px; border-radius: 6px;
    }
    .adminmobilebar__title {
        flex: 1 1 auto; min-width: 0; margin: 0;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        font-size: 14.5px; font-weight: 700; color: #c9cdd6;
    }
    .adminmobilebar__action { flex: 0 0 auto; }
    .adminmobilebar__action .btn-admin { padding: 8px 12px; font-size: 13px; }

    /* --- Sidebar → tiroir off-canvas (réutilise la nav verticale existante) --- */
    .adminbar {
        position: fixed; top: 0; left: 0; z-index: 100;
        width: min(86vw, 300px); height: 100vh; height: 100dvh;
        overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
        padding: 18px 14px;
        visibility: hidden;
        transform: translateX(-100%); transition: transform .25s ease, visibility .25s ease;
    }
    body.nav-open .adminbar { transform: translateX(0); visibility: visible; box-shadow: 2px 0 26px rgba(0,0,0,.4); }

    /* --- Backdrop + verrou de scroll --- */
    .adminbackdrop {
        display: block; position: fixed; inset: 0; z-index: 90;
        background: rgba(10,12,16,.5); touch-action: none; overscroll-behavior: contain;
        opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease;
    }
    body.nav-open .adminbackdrop { opacity: 1; visibility: visible; }
    body.nav-open { overflow: hidden; }

    /* --- Le head desktop laisse la place à l'app-bar (titre + action y sont repris) --- */
    .adminmain__head { display: none; }
    .adminmain__body { padding: 20px 16px 44px; }

    /* --- Grilles en une colonne --- */
    .stats { grid-template-columns: repeat(2, 1fr); }
    .panels, .editor, .cats-layout { grid-template-columns: 1fr; min-width: 0; }
    .editor__side { position: static; top: auto; }

    /* --- Toolbar / onglets / recherche : empilés et confinés --- */
    .toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
    .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .tabs::-webkit-scrollbar { display: none; }
    .tab { flex: 0 0 auto; white-space: nowrap; padding: 10px 14px; }
    .toolbar__search { width: 100%; }
    .toolbar__search input { min-width: 0; flex: 1 1 auto; width: 100%; }

    /* --- Tables de données : scroll horizontal confiné (mobile uniquement) --- */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table-wrap > .table { min-width: 600px; }

    /* --- Tables d'entités : cartes empilées (lisibilité mobile) --- */
    .table--cards, .table--cards tbody { display: block; width: 100%; }
    .table--cards thead {
        position: absolute; width: 1px; height: 1px; padding: 0;
        overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
    }
    .table--cards tr {
        display: block; background: #fff;
        border: 1px solid var(--line); border-radius: var(--radius);
        box-shadow: 0 1px 2px rgba(16,24,40,.05);
        padding: 4px 15px 10px; margin-bottom: 12px;
    }
    .table--cards tbody tr:hover { background: #fff; }
    .table--cards td {
        display: flex; justify-content: space-between; align-items: center; gap: 14px;
        padding: 9px 0; border-bottom: 1px solid #f1f2f4; text-align: right;
    }
    .table--cards tr td:last-child { border-bottom: 0; }
    .table--cards td::before {
        content: attr(data-label); flex: 0 0 auto; text-align: left;
        font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted);
    }
    .table--cards td.table__title {
        display: block; text-align: left; padding: 8px 0 10px; font-size: 15.5px; font-weight: 700;
    }
    .table--cards td.table__title::before { display: none; }
    .table--cards td.table__actions {
        display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 8px;
        white-space: normal; text-align: left; padding-top: 11px;
    }
    .table--cards td.table__actions::before { display: none; }
    .table--cards td.table__actions .lnk,
    .table--cards td.table__actions .table__edit {
        padding: 10px 14px; min-height: 40px; display: inline-flex; align-items: center;
        border: 1px solid var(--line); border-radius: 8px; background: #fff;
    }
    .table--cards td.table__actions .lnk--danger { border-color: #f3c2c7; }

    /* Cartes détachées de leur panneau conteneur (évite le cadre-dans-cadre) */
    .panel:has(> .table--cards) { background: transparent; border: 0; border-radius: 0; overflow: visible; }

    /* --- Garde-fous pour les blocs à CSS inline --- */
    #bgrid { grid-template-columns: 1fr !important; }
    .bulk-ctl { flex-wrap: wrap; }

    /* --- Barre de sauvegarde collante (éditeur d'article) --- */
    body.has-savebar .editor-savebar {
        display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
        padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
        background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(0,0,0,.07);
    }
    body.has-savebar .editor__actions button[type="submit"] { display: none; }
    body.has-savebar .adminmain__body { padding-bottom: 84px; }
}

@media (max-width: 560px) {
    .adminmain__body { padding-left: 16px; padding-right: 16px; }
    .stats { grid-template-columns: 1fr; }
    .adminbar { width: min(90vw, 320px); }
    /* Action de l'app-bar réduite à une pastille « + » quand la barre est saturée */
    .adminmobilebar__action .btn-admin { font-size: 0; padding: 8px 11px; }
    .adminmobilebar__action .btn-admin::before { content: "\FF0B"; font-size: 20px; font-weight: 800; }
}

@media (prefers-reduced-motion: reduce) {
    .adminbar, .adminbackdrop,
    .adminmobilebar__bars,
    .adminmobilebar__bars::before,
    .adminmobilebar__bars::after { transition: none; }
}
