:root {
    color-scheme: dark;

    --bg: #0d0f14;
    --bg-elevated: #151922;
    --bg-hover: #1c2130;
    --border: #262c3a;
    --border-strong: #364055;
    --text: #e8eaf0;
    --text-muted: #9aa3b5;
    --text-faint: #6b7385;
    --accent: #6c8cff;
    --accent-strong: #8aa2ff;
    --ok: #3ddc97;
    --warn: #ffc857;
    --danger: #ff6b6b;
    --ig: #e1306c;
    --fb: #1877f2;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent-strong);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ---------- Barre superieure ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(13, 15, 20, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.topbar__inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 600;
}

.brand:hover {
    text-decoration: none;
}

.brand__mark {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--accent), var(--ig));
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.brand__text em {
    font-style: normal;
    color: var(--text-muted);
    font-weight: 400;
}

.nav {
    display: flex;
    gap: 4px;
    margin-left: auto;
    flex-wrap: wrap;
}

.nav__link {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
}

.nav__link:hover {
    background: var(--bg-hover);
    color: var(--text);
    text-decoration: none;
}

.nav__link.is-active {
    background: var(--bg-elevated);
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--border-strong);
}

.topbar__logout {
    margin: 0;
}

/* ---------- Structure ---------- */

.main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 20px 64px;
}

.main--centered {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    max-width: 520px;
}

.main--centered > * {
    width: 100%;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.page-head__title {
    margin: 0 0 4px;
    font-size: 24px;
    letter-spacing: -0.01em;
}

.page-head__lead {
    margin: 0;
    color: var(--text-muted);
}

/* ---------- Cartes ---------- */

.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.card--narrow {
    max-width: 520px;
    margin: 0 auto;
}

.card__title {
    margin: 0 0 6px;
    font-size: 21px;
    letter-spacing: -0.01em;
}

.card__title--sm {
    font-size: 16px;
}

.card__lead {
    margin: 0 0 18px;
    color: var(--text-muted);
}

.hint {
    color: var(--text-faint);
    font-size: 13px;
    margin: 12px 0 4px;
}

.code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12.5px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-muted);
}

/* ---------- Formulaires ---------- */

.form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.field__input,
.field__textarea,
.field__select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 14.5px;
    padding: 10px 12px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field__textarea {
    min-height: 88px;
    resize: vertical;
    line-height: 1.5;
}

.field__input:focus,
.field__textarea:focus,
.field__select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108, 140, 255, 0.18);
}

.field__hint {
    font-size: 12.5px;
    color: var(--text-faint);
}

/* ---------- Boutons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
    background: var(--bg-hover);
    color: var(--text);
}

.btn:hover {
    text-decoration: none;
    background: var(--border);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn--primary {
    background: var(--accent);
    color: #0b0e16;
}

.btn--primary:hover {
    background: var(--accent-strong);
}

.btn--ghost {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text-muted);
}

.btn--ghost:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.btn--danger {
    background: transparent;
    border-color: rgba(255, 107, 107, 0.45);
    color: var(--danger);
}

.btn--danger:hover {
    background: rgba(255, 107, 107, 0.12);
}

.btn--sm {
    padding: 6px 11px;
    font-size: 13px;
}

/* ---------- Messages ---------- */

.flashes {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.flash {
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    font-size: 14px;
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
}

.flash--success {
    border-color: rgba(61, 220, 151, 0.4);
    background: rgba(61, 220, 151, 0.1);
}

.flash--error {
    border-color: rgba(255, 107, 107, 0.4);
    background: rgba(255, 107, 107, 0.1);
}

.flash--info {
    border-color: rgba(108, 140, 255, 0.4);
    background: rgba(108, 140, 255, 0.1);
}

/* ---------- Statistiques ---------- */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.stat {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat__value {
    font-size: 27px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.stat__label {
    font-size: 13px;
    color: var(--text-muted);
}

/* ---------- Liste de verification ---------- */

.checklist {
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.checklist__item {
    display: grid;
    grid-template-columns: 22px minmax(120px, auto) 1fr;
    align-items: baseline;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.checklist__item:last-child {
    border-bottom: none;
}

.checklist__state {
    font-weight: 700;
}

.checklist__state.is-ok {
    color: var(--ok);
}

.checklist__state.is-ko {
    color: var(--danger);
}

.checklist__detail {
    color: var(--text-faint);
    font-size: 13px;
    word-break: break-word;
}

/* ---------- Badges ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-hover);
    color: var(--text-muted);
}

.badge--ig {
    background: rgba(225, 48, 108, 0.16);
    color: #ff7ba8;
}

.badge--fb {
    background: rgba(24, 119, 242, 0.16);
    color: #7db1ff;
}

.badge--warn {
    background: rgba(255, 200, 87, 0.16);
    color: var(--warn);
}

.badge--ok {
    background: rgba(61, 220, 151, 0.16);
    color: var(--ok);
}

.text-warn {
    color: var(--warn);
}

/* ---------- Listes diverses ---------- */

.scopes {
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.scopes__item {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 13.5px;
    color: var(--text-muted);
}

.scopes__item code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px 7px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12.5px;
    color: var(--text);
}

.bullets {
    margin: 0;
    padding-left: 20px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
}

.check input {
    margin-top: 3px;
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}

.radio-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-list__item {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.radio-list__item:hover {
    border-color: var(--border-strong);
    background: var(--bg-hover);
}

.radio-list__item input {
    margin-top: 4px;
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}

.radio-list__item:has(input:checked) {
    border-color: var(--accent);
    background: rgba(108, 140, 255, 0.08);
}

.radio-list__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.radio-list__meta {
    font-size: 13px;
    color: var(--text-faint);
}

.btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.btn-row form {
    margin: 0;
}

/* ---------- Categories ---------- */

.cat-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cat {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cat--off {
    opacity: 0.6;
}

.cat__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.cat__name {
    margin: 0;
    font-size: 17px;
}

.cat__badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.cat__desc {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
}

.cat__reply {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
}

.cat__reply p {
    margin: 4px 0 0;
    font-size: 14.5px;
}

.cat__label {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    font-weight: 600;
}

.test-result {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.test-result p {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---------- Barre d'outils ---------- */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
}

.toolbar__filters,
.toolbar__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.toolbar__actions form {
    margin: 0;
}

.chip {
    padding: 6px 13px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
}

.chip:hover {
    text-decoration: none;
    background: var(--bg-hover);
    color: var(--text);
}

.chip.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #0b0e16;
}

/* ---------- Publications et commentaires ---------- */

.post {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.post__head {
    display: flex;
    gap: 15px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
}

.post__thumb {
    width: 74px;
    height: 74px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg);
    border: 1px solid var(--border);
}

.post__thumb--empty {
    display: block;
}

.post__meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.post__badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.post__caption {
    margin: 0;
    font-size: 14.5px;
    color: var(--text);
}

.post__date {
    margin: 0;
    font-size: 12.5px;
    color: var(--text-faint);
}

.group-approve {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 11px 18px;
    background: rgba(108, 140, 255, 0.07);
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}

.group-approve__label {
    color: var(--text-muted);
    flex: 1 1 260px;
}

.comments {
    display: flex;
    flex-direction: column;
}

.comment {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.comment:last-child {
    border-bottom: none;
}

.comment--flagged {
    background: rgba(255, 200, 87, 0.05);
    box-shadow: inset 3px 0 0 var(--warn);
}

.comment__head {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.comment__author {
    font-weight: 600;
    font-size: 14px;
}

.comment__date {
    font-size: 12.5px;
    color: var(--text-faint);
}

.comment__text {
    margin: 0;
    font-size: 15px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.comment__form {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.comment__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.check--inline {
    font-size: 13px;
    margin-right: 4px;
}

.check--inline input {
    margin-top: 0;
}

/* ---------- Reponses rapides ---------- */

.quick-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    position: sticky;
    top: 60px;
    z-index: 10;
}

.quick-bar__field {
    margin: 0;
}

.quick-bar code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 1px 5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11.5px;
}

.quick-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quick {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quick--off {
    opacity: 0.55;
}

.quick__head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.quick__name {
    margin: 0;
    font-size: 16px;
}

.quick__reply {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 13px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.quick__reply-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.quick__text {
    margin: 0;
    font-size: 14.5px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.btn.is-copied {
    border-color: rgba(61, 220, 151, 0.5);
    color: var(--ok);
}

/* ---------- Journal ---------- */

.log-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.log-row {
    display: grid;
    grid-template-columns: 140px 90px 1fr;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    align-items: baseline;
}

.log-row:last-child {
    border-bottom: none;
}

.log-row__time {
    color: var(--text-faint);
    font-size: 12.5px;
    white-space: nowrap;
}

.log-row__message {
    overflow-wrap: anywhere;
    color: var(--text-muted);
}

.log-row--error .log-row__message {
    color: #ffa8a8;
}

@media (max-width: 720px) {
    .log-row {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .post__head {
        flex-direction: column;
    }

    .post__thumb {
        width: 100%;
        height: 150px;
    }
}

@media (max-width: 640px) {
    .topbar__inner {
        gap: 12px;
    }

    .nav {
        order: 3;
        width: 100%;
        margin-left: 0;
    }

    .checklist__item {
        grid-template-columns: 22px 1fr;
    }

    .checklist__detail {
        grid-column: 2;
    }
}
