/* Xassaid back-office — feuille de style maison (sans framework).
   Tokens, coquille (sidebar + contenu), composants : boutons, cartes,
   tables, formulaires, badges, dialogues, combobox, pagination. */

:root {
    --paper: #f3f4f1;
    --surface: #ffffff;
    --surface-2: #f8f9f7;
    --ink: #1b1f1d;
    --ink-2: #4f5753;
    --muted: #7c847f;
    --line: #e2e5e2;
    --line-strong: #c9cec9;
    --accent: #0e7c47;
    --accent-ink: #0a5f36;
    --accent-soft: #e4f3ea;
    --danger: #a8231b;
    --danger-soft: #fbebe9;
    --warn: #8a5a00;
    --warn-soft: #fff3d6;
    --info: #1f5a9e;
    --info-soft: #e8f0fa;
    --radius: 6px;
    --radius-lg: 10px;
    --sidebar-w: 236px;
    --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}
html {
    -webkit-text-size-adjust: 100%;
}
body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--paper);
    font-feature-settings:
        "tnum" 1,
        "cv05" 1;
}
h1,
h2,
h3,
h4 {
    margin: 0;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
}
h1 {
    font-size: 22px;
}
h2 {
    font-size: 16px;
}
h3 {
    font-size: 14px;
}
p {
    margin: 0 0 10px;
}
a {
    color: var(--accent-ink);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
code {
    font-family: var(--mono);
    font-size: 12px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    padding: 1px 5px;
    border-radius: 4px;
}
img {
    max-width: 100%;
}
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.muted {
    color: var(--muted);
}
.small {
    font-size: 12.5px;
}
.nowrap {
    white-space: nowrap;
}
.right {
    text-align: right;
}
.hidden {
    display: none !important;
}
.mt-1 {
    margin-top: 6px;
}
.mt-2 {
    margin-top: 12px;
}
.mt-3 {
    margin-top: 20px;
}
.mb-2 {
    margin-bottom: 12px;
}
.mb-3 {
    margin-bottom: 20px;
}
.row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.vstack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.grow {
    flex: 1 1 auto;
    min-width: 0;
}

/* ---------- Coquille ---------- */
.shell {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: var(--sidebar-w);
    flex: none;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--line);
    overflow-y: auto;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 14px;
}
.brand img {
    height: 56px;
    width: auto;
    display: block;
    object-fit: contain;
}
.brand-tag {
    font-size: 11px;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 1px 6px;
    border-radius: 999px;
}
.nav {
    padding: 4px 12px 12px;
    flex: 1;
}
.nav-group {
    font-size: 11.5px;
    color: var(--muted);
    padding: 16px 10px 6px;
}
.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: var(--radius);
    color: var(--ink-2);
    font-size: 14px;
    text-decoration: none;
    position: relative;
}
.nav a i {
    font-size: 17px;
    color: var(--muted);
}
.nav a:hover {
    background: var(--surface-2);
    color: var(--ink);
    text-decoration: none;
}
.nav a.active {
    background: var(--accent-soft);
    color: var(--accent-ink);
    font-weight: 500;
}
.nav a.active i {
    color: var(--accent);
}
.nav a.active::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}
.nav .count {
    margin-left: auto;
    font-size: 11.5px;
    color: var(--muted);
    background: var(--surface-2);
    border: 1px solid var(--line);
    padding: 0 6px;
    border-radius: 999px;
}
.user-box {
    border-top: 1px solid var(--line);
    padding: 12px 20px 16px;
    font-size: 12.5px;
}
.user-box .email {
    color: var(--ink-2);
    word-break: break-all;
}
.user-box .role {
    color: var(--muted);
}
.user-box form {
    margin-top: 6px;
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.topbar {
    display: none;
}
.content {
    flex: 1;
}
.page {
    padding: 28px 32px 40px;
    max-width: 1280px;
}
.page-wide {
    max-width: none;
}
.footer {
    padding: 14px 32px;
    font-size: 12px;
    color: var(--muted);
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 20px;
    margin-bottom: 20px;
}
.page-head .sub {
    color: var(--muted);
    margin-top: 2px;
}
.page-head .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.page-head h1 .n {
    color: var(--muted);
    font-weight: 400;
    margin-left: 6px;
    font-size: 16px;
}

/* Menu mobile */
.drawer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 24, 22, 0.45);
    z-index: 40;
}
@media (max-width: 1023px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: none;
    }
    body.drawer-open .sidebar {
        transform: none;
        box-shadow:
            0 0 0 1px var(--line),
            0 20px 50px rgba(0, 0, 0, 0.2);
    }
    body.drawer-open .drawer-backdrop {
        display: block;
    }
    body.drawer-open {
        overflow: hidden;
    }
    .topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 10px 16px;
        background: var(--surface);
        border-bottom: 1px solid var(--line);
        position: sticky;
        top: 0;
        z-index: 30;
    }
    .topbar img {
        height: 36px;
        width: auto;
        display: block;
    }
    .page {
        padding: 18px 16px 32px;
    }
    .footer {
        padding: 12px 16px;
    }
    .page-head {
        margin-bottom: 14px;
    }
    .page-head .actions {
        width: 100%;
    }
    .page-head .actions .btn {
        flex: 1 1 auto;
        justify-content: center;
    }
}
@media (prefers-reduced-motion: reduce) {
    .sidebar {
        transition: none;
    }
}

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 12px;
    min-height: 34px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.btn i {
    font-size: 16px;
    line-height: 1;
}
.btn:hover {
    background: var(--surface-2);
    text-decoration: none;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-primary {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}
.btn-primary:hover {
    background: #2c332f;
}
.btn-accent {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-accent:hover {
    background: var(--accent-ink);
}
.btn-danger {
    color: var(--danger);
    border-color: #e7b9b5;
}
.btn-danger:hover {
    background: var(--danger-soft);
}
.btn-danger.solid {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.btn-ghost {
    border-color: transparent;
    background: transparent;
}
.btn-ghost:hover {
    background: var(--surface-2);
}
.btn-sm {
    padding: 4px 9px;
    min-height: 28px;
    font-size: 12.5px;
}
.btn-sm i {
    font-size: 15px;
}
.btn-icon {
    padding: 0;
    width: 30px;
    min-height: 30px;
}
.btn-icon.btn-sm {
    width: 28px;
    min-height: 28px;
}
.btn-group {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
}
form.inline {
    display: inline;
    margin: 0;
}

/* ---------- Cartes ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}
.card + .card {
    margin-top: 16px;
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
}
.card-head .hint {
    font-weight: 400;
    color: var(--muted);
    font-size: 12.5px;
}
.card-body {
    padding: 16px;
}
.card-foot {
    padding: 10px 16px;
    border-top: 1px solid var(--line);
}
.grid {
    display: grid;
    gap: 16px;
}
.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid-stats {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}
@media (max-width: 900px) {
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
}
.span-2 {
    grid-column: span 2;
}
@media (max-width: 900px) {
    .span-2 {
        grid-column: auto;
    }
}

.stat {
    display: block;
    padding: 14px 16px;
    color: inherit;
    text-decoration: none;
}
.stat:hover {
    text-decoration: none;
    border-color: var(--line-strong);
}
.stat .value {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.stat .label {
    color: var(--muted);
    font-size: 12.5px;
    margin-top: 4px;
}
.stat i {
    float: right;
    font-size: 18px;
    color: var(--muted);
}

/* ---------- Barre d'outils (recherche, filtres) ---------- */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}
.toolbar .input,
.toolbar .select,
.toolbar .combobox {
    min-width: 200px;
    flex: 1 1 200px;
    max-width: 360px;
}
.toolbar .result {
    color: var(--muted);
    font-size: 12.5px;
    margin-left: auto;
}
@media (max-width: 720px) {
    .toolbar .input,
    .toolbar .select,
    .toolbar .combobox {
        max-width: none;
    }
    .toolbar .result {
        margin-left: 0;
        width: 100%;
    }
}

/* ---------- Tables ---------- */
.table-wrap {
    overflow-x: auto;
}
.table {
    width: 100%;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    table-layout: auto;
}
.table th,
.table td {
    padding: 10px 14px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--line);
}
.table th {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    background: var(--surface-2);
    white-space: nowrap;
}
.table tbody tr:last-child td {
    border-bottom: 0;
}
.table tbody tr:hover {
    background: #fafbf9;
}
.table .idx {
    color: var(--muted);
    width: 1%;
    white-space: nowrap;
}
.table .slug {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
}
.table .actions-cell {
    width: 1%;
    white-space: nowrap;
}
.table .actions-cell .btn-group {
    flex-wrap: nowrap;
}
.table .empty-row td {
    color: var(--muted);
    text-align: center;
    padding: 28px;
}
.table .title {
    font-weight: 500;
}
.table td.clip {
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface-2);
    display: block;
}
.thumb.tall {
    width: 48px;
    height: 84px;
}
.avatar {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid var(--line);
    display: block;
}
.thumb-empty {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    color: var(--muted);
    font-size: 16px;
}

/* Mode empilé sur petits écrans : chaque ligne devient une carte,
   l'en-tête de colonne est reproduit via data-label. */
@media (max-width: 720px) {
    .table.stack thead {
        display: none;
    }
    .table.stack,
    .table.stack tbody,
    .table.stack tr,
    .table.stack td {
        display: block;
        width: 100%;
    }
    .table.stack tr {
        padding: 8px 14px 12px;
        border-bottom: 1px solid var(--line);
    }
    .table.stack tr:last-child {
        border-bottom: 0;
    }
    .table.stack td {
        display: grid;
        grid-template-columns: 96px minmax(0, 1fr);
        column-gap: 12px;
        align-items: center;
        padding: 5px 0;
        border: 0;
        max-width: none !important;
        white-space: normal;
        text-align: left;
    }
    .table.stack td > * {
        grid-column: 2;
    }
    .table.stack td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        grid-column: 1;
        grid-row: 1;
        align-self: start;
        padding-top: 2px;
    }
    .table.stack td:not([data-label]) {
        grid-template-columns: minmax(0, 1fr);
    }
    .table.stack td:not([data-label])::before {
        display: none;
    }
    .table.stack td:not([data-label]) > * {
        grid-column: 1;
    }
    .table.stack td.idx {
        display: none;
    }
    .table.stack td.actions-cell {
        padding-top: 8px;
    }
    .table.stack td.clip {
        overflow: visible;
        text-overflow: clip;
    }
    .table.stack tr:hover {
        background: transparent;
    }
}

/* Sélection groupée dans les tableaux */
.table th.chk,
.table td.chk {
    width: 1%;
    padding-right: 4px;
}
.table .chk input {
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
    margin: 0;
    display: block;
}
.bulk-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--accent-soft);
    border-bottom: 1px solid #bfe3cd;
    font-size: 13px;
}
.bulk-bar .result {
    color: var(--muted);
    font-size: 12.5px;
    margin-left: auto;
}
@media (max-width: 720px) {
    .table.stack td.chk {
        display: none;
    }
}

/* ---------- Formulaires ---------- */
.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 14px;
}
.field:last-child {
    margin-bottom: 0;
}
.field label,
.label {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-2);
}
.field .req::after {
    content: " *";
    color: var(--danger);
}
.field .help {
    font-size: 12px;
    color: var(--muted);
}
.fields-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 14px;
}
@media (max-width: 640px) {
    .fields-2 {
        grid-template-columns: 1fr;
    }
}
.input,
.select,
.textarea {
    width: 100%;
    font: inherit;
    font-size: 14px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    padding: 7px 10px;
    min-height: 36px;
}
.input:focus,
.select:focus,
.textarea:focus,
.combobox.open .combobox-btn {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea {
    resize: vertical;
    min-height: 90px;
}
.select {
    appearance: none;
    padding-right: 30px;
    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='%237c847f' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}
.input.sm,
.select.sm {
    min-height: 30px;
    padding: 4px 8px;
    font-size: 13px;
}
.input.w-auto,
.select.w-auto {
    width: auto;
}
input[type="file"].input {
    padding: 5px 8px;
}
input[type="file"].input::file-selector-button {
    font: inherit;
    font-size: 12.5px;
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    border-radius: 4px;
    padding: 3px 8px;
    margin-right: 10px;
    cursor: pointer;
}
.check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
}
.check input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    margin: 0;
}
.search {
    position: relative;
}
.search i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 16px;
}
.search .input {
    padding-left: 32px;
}

/* Combobox : select avec recherche (JS enrichit select[data-search]) */
.combobox {
    position: relative;
    width: 100%;
}
.combobox-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    font: inherit;
    font-size: 14px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    padding: 7px 10px;
    min-height: 36px;
    cursor: pointer;
}
.combobox-btn .txt {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.combobox-btn .txt.placeholder {
    color: var(--muted);
}
.combobox-btn i {
    color: var(--muted);
}
.combobox.sm .combobox-btn {
    min-height: 30px;
    padding: 4px 8px;
    font-size: 13px;
}
.combobox-pop {
    position: fixed;
    z-index: 60;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 32px rgba(20, 24, 22, 0.14);
    display: none;
    min-width: 240px;
}
.combobox.open .combobox-pop {
    display: block;
}
.combobox-pop .search {
    padding: 8px;
    border-bottom: 1px solid var(--line);
}
.combobox-list {
    max-height: 260px;
    overflow-y: auto;
    padding: 4px;
    margin: 0;
    list-style: none;
}
.combobox-list li {
    padding: 7px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13.5px;
    display: flex;
    gap: 8px;
    align-items: baseline;
}
.combobox-list li .grp {
    color: var(--muted);
    font-size: 12px;
}
.combobox-list li:hover,
.combobox-list li.hl {
    background: var(--surface-2);
}
.combobox-list li.sel {
    background: var(--accent-soft);
    color: var(--accent-ink);
}
.combobox-list li.none {
    color: var(--muted);
    cursor: default;
}
.combobox-list li.none:hover {
    background: transparent;
}
select[data-search].enhanced {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    margin: 0;
}

/* ---------- Badges, messages ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    padding: 1px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--ink-2);
    white-space: nowrap;
}
.badge.ok {
    background: var(--accent-soft);
    border-color: #bfe3cd;
    color: var(--accent-ink);
}
.badge.err {
    background: var(--danger-soft);
    border-color: #efc3bf;
    color: var(--danger);
}
.badge.warn {
    background: var(--warn-soft);
    border-color: #f0dca6;
    color: var(--warn);
}
.badge.info {
    background: var(--info-soft);
    border-color: #c3d6f1;
    color: var(--info);
}
.badge .spin {
    width: 9px;
    height: 9px;
    border: 1.5px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
.type-tag {
    font-size: 12px;
    color: var(--muted);
}

.flash {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 14px;
    border-radius: var(--radius);
    border: 1px solid;
    margin-bottom: 16px;
    font-size: 13.5px;
}
.flash i {
    font-size: 17px;
    line-height: 1.3;
}
.flash ul {
    margin: 0;
    padding-left: 18px;
}
.flash.ok {
    background: var(--accent-soft);
    border-color: #bfe3cd;
    color: var(--accent-ink);
}
.flash.err {
    background: var(--danger-soft);
    border-color: #efc3bf;
    color: var(--danger);
}
.flash.warn {
    background: var(--warn-soft);
    border-color: #f0dca6;
    color: var(--warn);
}
.flash .close {
    margin-left: auto;
    background: none;
    border: 0;
    color: inherit;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
}

.empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--muted);
}
.empty i {
    font-size: 28px;
    display: block;
    margin-bottom: 6px;
}

/* ---------- Progression ---------- */
.progress {
    height: 8px;
    background: var(--line);
    border-radius: 999px;
    overflow: hidden;
}
.progress > span {
    display: block;
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
    transition: width 0.3s ease;
}
.progress.thin {
    height: 5px;
}
.progress > span.err {
    background: var(--danger);
}
.progress > span.busy {
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.25) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.25) 50%,
        rgba(255, 255, 255, 0.25) 75%,
        transparent 75%
    );
    background-size: 16px 16px;
    animation: stripes 1s linear infinite;
}
@keyframes stripes {
    from {
        background-position: 0 0;
    }
    to {
        background-position: 16px 0;
    }
}
.upload-state {
    display: none;
    margin-top: 8px;
}
.upload-state .txt {
    font-size: 12.5px;
    color: var(--muted);
    margin-bottom: 4px;
}
.upload-error {
    display: none;
    margin-top: 8px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---------- Onglets ---------- */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    margin-bottom: 16px;
}
.tabs a {
    padding: 8px 12px;
    color: var(--ink-2);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    gap: 6px;
    align-items: center;
}
.tabs a:hover {
    color: var(--ink);
}
.tabs a.active {
    color: var(--ink);
    border-color: var(--ink);
    font-weight: 500;
}
.tabs .n {
    font-size: 11.5px;
    color: var(--muted);
    background: var(--surface-2);
    border: 1px solid var(--line);
    padding: 0 6px;
    border-radius: 999px;
}

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 16px;
    border-top: 1px solid var(--line);
    font-size: 13px;
}
.pagination .info {
    color: var(--muted);
}
.pagination ul {
    display: flex;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.pagination li a,
.pagination li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    color: var(--ink-2);
    text-decoration: none;
}
.pagination li a:hover {
    background: var(--surface-2);
    border-color: var(--line);
}
.pagination li.active span {
    background: var(--ink);
    color: #fff;
}
.pagination li.disabled span {
    color: var(--line-strong);
}

/* ---------- Dialogues ---------- */
dialog.modal {
    border: 0;
    padding: 0;
    background: transparent;
    max-width: min(640px, calc(100vw - 24px));
    width: 100%;
    margin: auto;
}
dialog.modal.lg {
    max-width: min(800px, calc(100vw - 24px));
}
dialog.modal.sm {
    max-width: min(460px, calc(100vw - 24px));
}
dialog.modal::backdrop {
    background: rgba(20, 24, 22, 0.5);
}
dialog.modal .box {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
dialog.modal .box > form {
    display: contents;
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}
.modal-head h2 {
    font-size: 16px;
}
.modal-body {
    padding: 18px;
    overflow-y: auto;
}
.modal-foot {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
    padding: 12px 18px;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
}
.modal-foot .left {
    margin-right: auto;
}
.modal-body.dark {
    background: #000;
    padding: 0;
    text-align: center;
}
.modal-body video {
    max-width: 100%;
    max-height: 70vh;
    display: block;
    margin: 0 auto;
}

/* ---------- Divers ---------- */
.kv {
    width: 100%;
    font-size: 13px;
    border-collapse: collapse;
}
.kv td {
    padding: 5px 0;
    border-bottom: 1px dashed var(--line);
}
.kv td:last-child {
    text-align: right;
    font-weight: 500;
}
.kv tr:last-child td {
    border-bottom: 0;
}
.list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.list li {
    padding: 9px 16px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}
.list li:last-child {
    border-bottom: 0;
}
.bar-row {
    padding: 8px 16px;
    border-bottom: 1px solid var(--line);
}
.bar-row:last-child {
    border-bottom: 0;
}
.bar-row .row {
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 4px;
}
.log {
    font-family: var(--mono);
    font-size: 12px;
    max-height: 360px;
    overflow: auto;
    padding: 8px 16px;
}
.log div {
    padding: 4px 0;
    border-bottom: 1px dashed var(--line);
}
.log time {
    color: var(--muted);
    margin-right: 8px;
}
.log .error {
    color: var(--danger);
}
.log .warn {
    color: var(--warn);
}
.pulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    margin-right: 6px;
    animation: blink 1.4s infinite;
}
@keyframes blink {
    50% {
        opacity: 0.25;
    }
}
@media (prefers-reduced-motion: reduce) {
    .pulse,
    .badge .spin,
    .progress > span.busy {
        animation: none;
    }
}
.err-text {
    color: var(--warn);
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}
.mini {
    display: inline-block;
    width: 90px;
    vertical-align: middle;
    margin-right: 8px;
}

/* ---------- Page de connexion ---------- */
.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}
.login .card {
    width: 100%;
    max-width: 380px;
    padding: 28px;
}
.login .brand {
    justify-content: center;
    padding: 0 0 20px;
}
.login .brand img {
    width: 350px;
    object-fit: contain;
}
.login .btn {
    width: 100%;
    margin-top: 6px;
}
