/* CUL.DEV – back office */
:root {
    --ink: #2b2a2a; --muted: #6b6a66; --olive: #637c1f; --olive-deep: #4b5f15;
    --green: #4d8a35; --blue: #2e7cc0; --yellow: #e9b61f; --red: #cc2a21; --charcoal: #4a4849;
    --bg: #f5f6f1; --line: #e1e3da; --radius: 8px;
    --bs-primary: #637c1f; --bs-primary-rgb: 99, 124, 31;
    --bs-link-color: #4b5f15; --bs-link-color-rgb: 75, 95, 21;
    --bs-link-hover-color: #2b2a2a;
}
body.bo { font-family: "Archivo", "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--ink); font-size: .97rem; }
.bo h1 { font-size: 1.65rem; font-weight: 750; margin: 0; }
.bo h2 { font-size: 1.08rem; font-weight: 700; margin-bottom: .9rem; }
.btn-primary { --bs-btn-bg: var(--olive); --bs-btn-border-color: var(--olive); --bs-btn-hover-bg: var(--olive-deep); --bs-btn-hover-border-color: var(--olive-deep); --bs-btn-active-bg: var(--olive-deep); --bs-btn-active-border-color: var(--olive-deep); }
.btn-outline-primary { --bs-btn-color: var(--olive-deep); --bs-btn-border-color: var(--olive); --bs-btn-hover-bg: var(--olive); --bs-btn-hover-border-color: var(--olive); }
.form-control:focus, .form-select:focus { border-color: var(--olive); box-shadow: 0 0 0 .2rem rgba(99,124,31,.18); }
.form-check-input:checked { background-color: var(--olive); border-color: var(--olive); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.ribbon { display: flex; height: 6px; }
.ribbon i { flex: 1; }
.ribbon i:nth-child(1) { background: #d9d9d6; } .ribbon i:nth-child(2) { background: var(--blue); }
.ribbon i:nth-child(3) { background: var(--yellow); } .ribbon i:nth-child(4) { background: var(--red); }
.ribbon i:nth-child(5) { background: var(--charcoal); } .ribbon i:nth-child(6) { background: var(--green); }

/* Shell */
.bo-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.bo-side { background: var(--ink); color: #cfcfca; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; border-top: 6px solid var(--olive); }
.bo-brand { display: flex; align-items: center; gap: .7rem; padding: 1.2rem 1.25rem; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.1rem; }
.bo-brand img { background: #fff; border-radius: 6px; padding: 2px; }
.bo-brand small { display: block; font-weight: 500; font-size: .75rem; color: #a9a9a3; }
.bo-side ul { list-style: none; margin: 0; padding: .5rem .75rem; }
.bo-side li a { display: flex; justify-content: space-between; align-items: center; padding: .6rem .8rem; border-radius: 6px; color: #d9d9d4; text-decoration: none; font-weight: 550; }
.bo-side li a:hover { background: rgba(255,255,255,.07); color: #fff; }
.bo-side li a[aria-current="page"] { background: var(--olive); color: #fff; }
.badge-count { background: var(--red); color: #fff; border-radius: 999px; font-size: .75rem; padding: .05rem .5rem; }
.bo-side-foot { margin-top: auto; padding: 1rem 1.5rem 1.4rem; font-size: .9rem; }
.bo-side-foot a { color: #bdbdb6; }

.bo-main { min-width: 0; display: flex; flex-direction: column; }
.bo-top { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; padding: .8rem 2rem; background: #fff; border-bottom: 1px solid var(--line); }
.bo-menu { display: none; }
.bo-user { display: flex; align-items: center; gap: 1rem; }
.bo-user-name { text-decoration: none; color: var(--ink); font-weight: 600; display: flex; align-items: center; gap: .6rem; }
.bo-content { padding: 1.8rem 2rem 3rem; max-width: 1400px; width: 100%; }
.bo-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.bo-head p.text-muted { max-width: 75ch; margin-top: .4rem; }
.crumb { margin: 0 0 .2rem; font-size: .88rem; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.4rem; margin-bottom: 1.25rem; }
.narrow-panel { max-width: 760px; }
.panel-list { list-style: none; padding: 0; margin: 0; }
.panel-list li { padding: .55rem 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.panel-list li:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: 11rem 1fr; gap: .45rem 1rem; margin: 0; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; word-break: break-word; }

/* Stats */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; text-decoration: none; color: var(--ink); border-top: 4px solid var(--charcoal); }
.stat strong { display: block; font-size: 1.8rem; font-weight: 800; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .9rem; }
.stat:hover { border-color: var(--olive); }
.stat.status-draft { border-top-color: #b5b5ae; } .stat.status-pending { border-top-color: var(--yellow); }
.stat.status-published { border-top-color: var(--green); } .stat.status-archived { border-top-color: var(--charcoal); }

/* Pills */
.status-pill, .role-pill, .cat-pill { display: inline-block; font-size: .78rem; font-weight: 650; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap; }
.status-draft { background: #ecece8; color: #55544f; }
.status-pending { background: #fbefc7; color: #7a5c00; }
.status-published { background: #e1efd9; color: #2d5a1c; }
.status-archived { background: #e4e3e3; color: #4a4849; }
.role-superadmin { background: var(--red); color: #fff; }
.role-admin { background: var(--blue); color: #fff; }
.role-editeur { background: var(--yellow); color: var(--ink); }
.role-auteur { background: #e1efd9; color: #2d5a1c; }
.cat-pill { background: #eef0e8; color: var(--ink); }

/* Tables & filtres */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; }
.filters .form-control, .filters .form-select { width: auto; min-width: 170px; flex: 1 1 170px; }
.filters .form-check { margin: 0 .5rem; display: flex; gap: .4rem; align-items: center; }
.grid-view { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem 1rem 1rem; }
.grid-view .summary { color: var(--muted); font-size: .88rem; padding: .5rem 0; }
.bo-table th { font-size: .82rem; color: var(--muted); font-weight: 650; white-space: nowrap; }
.bo-table th a { color: inherit; text-decoration: none; }
.row-inactive td { opacity: .55; }
.row-unread td { font-weight: 600; background: #fbfcf6; }
.log-table code { font-size: .8rem; color: var(--olive-deep); }
.log-desc-cell { max-width: 460px; }
.log-cat-security td:first-child { box-shadow: inset 4px 0 var(--red); }
.log-cat-auth td:first-child { box-shadow: inset 4px 0 var(--blue); }
.log-cat-data td:first-child { box-shadow: inset 4px 0 var(--green); }
.log-cat-action td:first-child { box-shadow: inset 4px 0 var(--yellow); }
.pagination { margin-top: 1rem; }
.page-link { color: var(--olive-deep); }
.active > .page-link { background: var(--olive); border-color: var(--olive); }
.role-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.role-tabs a { padding: .35rem .9rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--ink); font-size: .9rem; }
.role-tabs a[aria-current="page"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Journal (liste) */
.log-list { list-style: none; padding: 0; margin: 0; }
.log-list li { display: grid; grid-template-columns: 14px 1fr; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.log-list li:last-child { border-bottom: 0; }
.log-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: .45rem; background: #b5b5ae; }
.log-cat-auth .log-dot { background: var(--blue); } .log-cat-data .log-dot { background: var(--green); }
.log-cat-action .log-dot { background: var(--yellow); } .log-cat-security .log-dot { background: var(--red); }
.log-cat-system .log-dot { background: var(--charcoal); }
.log-desc { display: block; }
.log-meta { display: block; color: var(--muted); font-size: .82rem; }
.log-list--compact .log-desc { font-size: .92rem; }
.diff-table th { width: 22%; font-weight: 600; }
.diff-old { background: #fbeceb; word-break: break-word; }
.diff-new { background: #eaf4e3; word-break: break-word; }
pre.json { background: #f6f6f2; border-radius: 6px; padding: 1rem; font-size: .82rem; white-space: pre-wrap; }

/* Formulaires */
.role-option { display: flex; gap: .7rem; align-items: flex-start; padding: .75rem .8rem; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .5rem; cursor: pointer; }
.role-option:has(input:checked) { border-color: var(--olive); background: #f4f7ec; }
.role-option input { margin-top: .3rem; }
.role-option strong { display: block; }
.role-option small { color: var(--muted); }
.cover-preview { width: 100%; border-radius: 6px; margin-bottom: .75rem; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; }
.swatch-green { background: var(--green); } .swatch-blue { background: var(--blue); } .swatch-yellow { background: var(--yellow); }
.swatch-red { background: var(--red); } .swatch-olive { background: var(--olive); } .swatch-charcoal { background: var(--charcoal); }
.rte { background: #fff; min-height: 380px; font-family: "Source Serif 4", Georgia, serif; font-size: 1.05rem; }
.rte + .rte-source.is-enhanced { display: none; }
.ql-toolbar.ql-snow { border-radius: 6px 6px 0 0; border-color: #ced4da; }
.ql-container.ql-snow { border-radius: 0 0 6px 6px; border-color: #ced4da; }
.message-body { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); line-height: 1.7; }

/* Connexion */
.bo-login { min-height: 100vh; }
.login-wrap { display: grid; place-items: center; min-height: calc(100vh - 6px); padding: 2rem 1rem; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 2.2rem 2rem; width: 100%; max-width: 410px; }
.login-logo { width: 220px; margin-bottom: 1.4rem; }
.login-card h1 { font-size: 1.45rem; margin-bottom: .3rem; }
.login-note { font-size: .85rem; color: var(--muted); margin: 1rem 0 0; text-align: center; }

@media (max-width: 900px) {
    .bo-shell { grid-template-columns: 1fr; }
    .bo-side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
    .bo-side.is-open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
    .bo-menu { display: inline-block; margin-right: auto; background: none; border: 1px solid var(--line); border-radius: 6px; padding: .35rem .8rem; font-weight: 600; }
    .bo-top, .bo-content { padding-left: 1rem; padding-right: 1rem; }
    .bo-user-name .role-pill { display: none; }
    .kv { grid-template-columns: 1fr; }
    .kv dd { margin-bottom: .5rem; }
}

/* ------------------------------------------------------ Bouton haut de page */
.to-top {
    position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 60;
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .65rem .9rem; border-radius: 999px;
    background: var(--olive); color: #fff; text-decoration: none;
    font-weight: 650; font-size: .9rem; box-shadow: 0 6px 18px rgba(0,0,0,.18);
    opacity: 0; transform: translateY(12px); pointer-events: none;
    transition: opacity .2s ease, transform .2s ease, background .2s;
}
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover, .to-top:focus-visible { background: var(--olive-deep); color: #fff; }
.bo .to-top { padding: .7rem; }
@media print { .to-top { display: none !important; } }
