/* ==========================================================================
   Back-office de Clouet & associés
   Thème repris du site public : bordeaux, or, papier ; Cormorant Garamond + Montserrat.
   Principes : contraste AA, focus visibles, cibles ≥ 44 px, mouvement discret.
   ========================================================================== */

:root {
    --ink: #1b1613;
    --ink-soft: #3a322c;
    --muted: #6b6258;
    --paper: #faf7f2;
    --paper-2: #f3ede3;
    --white: #fff;
    --line: #e3dacb;
    --line-strong: #c9bba3;
    --wine: #5a1822;
    --wine-2: #74202d;
    --gold: #c8a45e;
    --gold-light: #dcc088;
    --gold-deep: #86672a;
    --success: #1f6b3a;
    --success-bg: #e8f3ec;
    --danger: #a3231b;
    --danger-bg: #fbeceb;
    --warning: #7a5200;
    --warning-bg: #fbf1dc;
    --info: #1d4f7a;
    --info-bg: #e7f0f8;

    --font-ui: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;

    --sidebar: 272px;
    --radius: 10px;
    --shadow-1: 0 1px 2px rgba(27, 22, 19, .06), 0 1px 3px rgba(27, 22, 19, .05);
    --shadow-2: 0 8px 28px rgba(27, 22, 19, .14);
    --ease: cubic-bezier(.2, .7, .2, 1);

    --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-bottom: 110px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 .9375rem/1.55 var(--font-ui); color: var(--ink-soft); background: var(--paper); min-height: 100dvh; }
img { max-width: 100%; height: auto; }
a { color: var(--wine); text-underline-offset: 3px; }
a:hover { color: var(--wine-2); }
h1, h2, h3 { color: var(--ink); margin: 0; line-height: 1.2; }
p { margin: 0 0 var(--s4); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--gold-light); color: var(--ink); }

.icon { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 1rem; height: 1rem; }

.skip-link { position: absolute; left: var(--s4); top: -100px; z-index: 200; padding: var(--s3) var(--s4); background: var(--ink); color: var(--white); border-radius: var(--radius); }
.skip-link:focus { top: var(--s3); }

/* ---------- Coquille : bandeau latéral + zone de contenu ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100dvh; }

.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; background: var(--ink); color: #d9cfc0; overflow-y: auto; z-index: 60; }
.sidebar__brand { display: block; padding: var(--s5) var(--s5) var(--s4); text-decoration: none; color: var(--white); border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sidebar__brand strong { display: block; font: 600 1.5rem/1.1 var(--font-display); letter-spacing: .01em; }
.sidebar__brand strong em { color: var(--gold); font-style: italic; }
.sidebar__brand span { display: block; margin-top: 6px; font-size: .6875rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-light); }

.nav-group { padding: var(--s4) var(--s3) 0; }
.nav-group__title { margin: 0 var(--s3) var(--s2); font-size: .6875rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: #a89b88; }
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-link { position: relative; display: flex; align-items: center; gap: var(--s3); min-height: 44px; padding: 0 var(--s3); border-radius: 8px; color: #d9cfc0; text-decoration: none; font-weight: 500; transition: background-color .15s var(--ease), color .15s var(--ease); }
.nav-link:hover { background: rgba(255, 255, 255, .07); color: var(--white); }
.nav-link[aria-current="page"] { background: rgba(200, 164, 94, .16); color: var(--white); }
.nav-link[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.nav-link .badge-count { margin-left: auto; }
.badge-count { min-width: 22px; padding: 1px 7px; border-radius: 99px; background: var(--gold); color: var(--ink); font-size: .75rem; font-weight: 700; text-align: center; }

.sidebar__user { margin-top: auto; padding: var(--s4); border-top: 1px solid rgba(255, 255, 255, .08); display: grid; gap: var(--s3); }
.user-card { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--wine-2); color: var(--white); font-weight: 600; font-size: .875rem; letter-spacing: .04em; }
.user-card__name { color: var(--white); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card__role { font-size: .75rem; color: #a89b88; }
.sidebar__links { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.sidebar__links a { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 8px; color: #d9cfc0; text-decoration: none; font-size: .8125rem; font-weight: 500; }
.sidebar__links a:hover { background: rgba(255, 255, 255, .08); color: var(--white); }

/* Le voile du menu mobile ne doit jamais occuper une cellule de la grille */
.scrim { position: fixed; inset: 0; pointer-events: none; opacity: 0; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: var(--s3); min-height: 64px; padding: 0 var(--s6); background: rgba(250, 247, 242, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar__crumbs { display: flex; align-items: center; gap: var(--s2); min-width: 0; font-size: .8125rem; color: var(--muted); white-space: nowrap; overflow: hidden; }
.topbar__crumbs a { color: var(--muted); text-decoration: none; }
.topbar__crumbs a:hover { color: var(--wine); text-decoration: underline; }
.topbar__crumbs [aria-current] { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.topbar__spacer { flex: 1; }
.icon-btn.menu-toggle { display: none; }

.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: var(--s6) var(--s6) var(--s7); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); }
.page-head__eyebrow { margin: 0 0 4px; font-size: .6875rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-deep); }
.page-head h1 { font: 600 clamp(1.875rem, 3vw, 2.5rem)/1.1 var(--font-display); }
.page-head__actions { display: flex; flex-wrap: wrap; gap: var(--s3); }
.page-head__lead { margin: var(--s2) 0 0; color: var(--muted); max-width: 60ch; }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s5); border: 1.5px solid transparent; border-radius: 8px; font: 600 .875rem/1 var(--font-ui); letter-spacing: .02em; text-decoration: none; cursor: pointer; transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease); touch-action: manipulation; }
.btn--primary { background: var(--wine); color: var(--white); }
.btn--primary:hover { background: var(--wine-2); color: var(--white); }
.btn--secondary { background: var(--white); color: var(--ink); border-color: var(--line-strong); }
.btn--secondary:hover { border-color: var(--ink); color: var(--ink); }
.btn--ghost { background: transparent; color: var(--ink-soft); }
.btn--ghost:hover { background: var(--paper-2); color: var(--ink); }
.btn--danger { background: var(--danger); color: var(--white); }
.btn--danger:hover { background: #8a1c15; color: var(--white); }
.btn--sm { min-height: 36px; padding: 0 var(--s3); font-size: .8125rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.is-loading { pointer-events: none; opacity: .75; }
.btn.is-loading::after { content: ""; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-soft); cursor: pointer; text-decoration: none; transition: background-color .15s var(--ease), color .15s var(--ease); touch-action: manipulation; }
.icon-btn:hover { background: var(--paper-2); color: var(--ink); }
.icon-btn--danger:hover { background: var(--danger-bg); color: var(--danger); }
.icon-btn[disabled] { opacity: .3; cursor: not-allowed; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.row-actions form { margin: 0; }

/* ---------- Cartes, badges, alertes ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
.card__head h2 { font: 600 1.375rem/1.2 var(--font-display); }
.card__body { padding: var(--s5); }
.card__body--flush { padding: 0; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--success { background: var(--success-bg); color: var(--success); }
.badge--info { background: var(--info-bg); color: var(--info); }
.badge--warning { background: var(--warning-bg); color: var(--warning); }
.badge--neutral { background: var(--paper-2); color: var(--muted); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--paper-2); color: var(--ink-soft); font-size: .75rem; }

.toasts { display: grid; gap: var(--s3); margin-bottom: var(--s5); }
.alert { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--radius); border: 1px solid; font-size: .9375rem; }
.alert .icon { margin-top: 2px; }
.alert--success { background: var(--success-bg); border-color: #b7d9c3; color: #17512c; }
.alert--error { background: var(--danger-bg); border-color: #efc1be; color: #7d1b16; }
.alert--info { background: var(--info-bg); border-color: #bcd5ea; color: var(--info); }
.alert__close { margin: -6px -8px -6px auto; }
.alert[data-dismiss] { transition: opacity .3s var(--ease), transform .3s var(--ease); }
.alert.is-leaving { opacity: 0; transform: translateY(-4px); }

/* ---------- Barre d'outils de liste ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
.search { position: relative; flex: 1 1 280px; max-width: 420px; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { width: 100%; min-height: 44px; padding: 0 var(--s4) 0 42px; border: 1.5px solid var(--line-strong); border-radius: 8px; background: var(--white); font: inherit; font-size: 1rem; color: var(--ink); }
.toolbar__count { color: var(--muted); font-size: .8125rem; }
.segmented-links { display: inline-flex; padding: 3px; background: var(--paper-2); border-radius: 8px; }
.segmented-links a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--s4); border-radius: 6px; color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: .8125rem; }
.segmented-links a[aria-current="true"] { background: var(--white); color: var(--ink); box-shadow: var(--shadow-1); }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table caption { text-align: left; }
.table th { padding: var(--s3) var(--s5); text-align: left; font-size: .6875rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); background: var(--paper); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: var(--s3) var(--s5); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color .12s var(--ease); }
.table tbody tr:hover { background: #fcfaf6; }
.table .cell-title { font-weight: 600; color: var(--ink); min-width: 240px; }
.table .cell-title a { color: inherit; text-decoration: none; }
.table .cell-title a:hover { color: var(--wine); text-decoration: underline; }
.table .cell-sub { display: block; margin-top: 2px; font-weight: 400; font-size: .8125rem; color: var(--muted); }
.table .cell-num, .table .cell-date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .cell-actions { width: 1%; white-space: nowrap; }
.table .is-unread .cell-title { font-weight: 700; }
.table .is-unread .cell-title::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--gold); }
.table .indent { display: inline-block; }
.table .tree-line { color: var(--line-strong); margin-right: 6px; }

.empty { display: grid; justify-items: center; gap: var(--s3); padding: var(--s7) var(--s5); text-align: center; color: var(--muted); }
.empty .icon { width: 2.5rem; height: 2.5rem; color: var(--gold-deep); }
.empty h3 { font: 600 1.5rem/1.2 var(--font-display); }
.empty p { margin: 0; max-width: 44ch; }

.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5); border-top: 1px solid var(--line); font-size: .8125rem; color: var(--muted); }
.pagination__links { display: flex; gap: var(--s2); }

/* ---------- Tableau de bord ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s4); margin-bottom: var(--s5); }
.stat { position: relative; display: grid; gap: 2px; padding: var(--s5); text-decoration: none; color: inherit; transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.stat:hover { border-color: var(--gold); box-shadow: var(--shadow-2); }
.stat__icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: var(--s3); border-radius: 10px; background: var(--paper-2); color: var(--wine); }
.stat__value { font: 600 2.5rem/1 var(--font-display); color: var(--ink); font-variant-numeric: lining-nums; }
.stat__label { font-size: .8125rem; color: var(--muted); font-weight: 500; }
.stat--alert .stat__icon { background: var(--wine); color: var(--white); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s5); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: var(--s4); padding: var(--s3) var(--s5); border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list__date { flex: none; width: 56px; text-align: center; line-height: 1.1; font-variant-numeric: tabular-nums; }
.list__date b { display: block; font: 600 1.5rem/1 var(--font-display); color: var(--wine); }
.list__date small { font-size: .6875rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.list__main { min-width: 0; flex: 1; }
.list__main a { color: var(--ink); font-weight: 600; text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list__main a:hover { color: var(--wine); text-decoration: underline; }
.list__main small { color: var(--muted); }
.quick-actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-bottom: var(--s5); }

/* ---------- Formulaires ---------- */
.editor { display: grid; gap: var(--s5); align-items: start; }
@media (min-width: 1100px) { .editor--aside { grid-template-columns: minmax(0, 1fr) 340px; } .editor__aside { position: sticky; top: 84px; } }
.stack { display: grid; gap: var(--s5); }
.form-grid { display: grid; gap: var(--s4) var(--s5); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid > .field--full, .form-grid > .field--wide { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field > label, .field > .label { font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); }
.field .req { color: var(--wine); margin-left: 2px; }
.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .field select, .field textarea { width: 100%; min-height: 46px; padding: 10px 14px; border: 1.5px solid var(--line-strong); border-radius: 8px; background: var(--white); color: var(--ink); font: inherit; font-size: 1rem; transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.field textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--ink-soft); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--wine); box-shadow: 0 0 0 3px rgba(200, 164, 94, .5); }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--danger); }
.field select { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9' fill='none' stroke='%235a1822' stroke-width='1.6'%3E%3Cpath d='M1 1l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.field input[type="file"] { padding: 12px; border: 1.5px dashed var(--line-strong); border-radius: 8px; background: var(--paper); font-size: .875rem; max-width: 100%; }
.field input[type="file"]::file-selector-button { margin-right: 12px; min-height: 36px; padding: 0 14px; border: 1.5px solid var(--ink); border-radius: 6px; background: var(--white); font: 600 .8125rem var(--font-ui); cursor: pointer; }
.field__hint { margin: 0; font-size: .8125rem; color: var(--muted); }
.field-error { margin: 0; display: flex; gap: 6px; align-items: flex-start; font-size: .8125rem; font-weight: 500; color: var(--danger); }
.field-counter { font-size: .75rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.field-counter.is-over { color: var(--warning); font-weight: 600; }
.field--check { gap: 4px; }
.check { display: flex; align-items: center; gap: var(--s3); min-height: 44px; cursor: pointer; font-weight: 500; color: var(--ink); text-transform: none; letter-spacing: 0; font-size: .9375rem; }
.check input { width: 20px; height: 20px; flex: none; accent-color: var(--wine); cursor: pointer; }
.field--check .field__hint { padding-left: 32px; margin-top: -6px; }
.choice-list { display: flex; flex-wrap: wrap; gap: var(--s2); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice label { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--s4); border: 1.5px solid var(--line-strong); border-radius: 99px; background: var(--white); color: var(--ink-soft); font-size: .875rem; font-weight: 500; letter-spacing: 0; text-transform: none; cursor: pointer; transition: all .15s var(--ease); }
.choice input:hover + label { border-color: var(--ink); }
.choice input:checked + label { background: var(--wine); border-color: var(--wine); color: var(--white); }
.choice input:focus-visible + label { outline: 3px solid var(--gold); outline-offset: 2px; }
.choice-list.segmented { display: inline-flex; padding: 3px; background: var(--paper-2); border-radius: 10px; gap: 2px; width: fit-content; max-width: 100%; }
.segmented .choice label { border: 0; border-radius: 8px; background: transparent; min-height: 40px; }
.segmented .choice input:checked + label { background: var(--white); color: var(--wine); box-shadow: var(--shadow-1); }
.choice-list.stacked { flex-direction: column; align-items: stretch; }
.stacked .choice label { border-radius: 8px; width: 100%; padding: var(--s3) var(--s4); min-height: 48px; }
.photo-current { display: flex; gap: var(--s4); align-items: center; padding: var(--s3); border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.photo-current img { width: 120px; height: 80px; object-fit: cover; border-radius: 6px; background: var(--paper-2); }
.photo-current p { margin: 0; font-size: .8125rem; color: var(--muted); }
.photo-preview { max-width: 240px; border-radius: 8px; border: 1px solid var(--line); }
.publication-dates { display: grid; gap: var(--s3); padding: var(--s4); border: 1px dashed var(--line-strong); border-radius: 8px; background: var(--paper); }
.publication-dates[hidden] { display: none; }
.form-actions { position: sticky; bottom: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin: var(--s5) calc(var(--s6) * -1) calc(var(--s7) * -1); padding: var(--s4) var(--s6); background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
.form-actions__spacer { flex: 1; }
.error-summary { padding: var(--s4) var(--s5); margin-bottom: var(--s5); border: 1.5px solid var(--danger); border-radius: var(--radius); background: var(--danger-bg); color: #7d1b16; }
.error-summary h2 { font: 700 1rem/1.3 var(--font-ui); color: #7d1b16; margin-bottom: var(--s2); }
.error-summary ul { margin: 0; padding-left: 1.2em; }
.error-summary a { color: inherit; font-weight: 600; }
.danger-zone { border-color: #efc1be; }
.link-external { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Arbre des menus ---------- */
.tree-row-title { display: flex; align-items: center; gap: var(--s2); }

/* ---------- Glisser-déposer des entrées de menu (JavaScript requis ; sinon, boutons monter/descendre) ---------- */
.drag-handle { display: none; flex: none; place-items: center; width: 28px; height: 36px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: grab; touch-action: none; }
.is-sortable .drag-handle { display: inline-grid; }
.drag-handle:hover { background: var(--paper-2); color: var(--ink); }
.drag-handle:focus-visible { outline: 2px solid var(--wine); outline-offset: 1px; }
.sortable-hint { display: flex; align-items: center; gap: var(--s2); margin: 0; padding: var(--s3) var(--s5); border-bottom: 1px solid var(--line); font-size: .8125rem; color: var(--muted); }
.is-sorting, .is-sorting * { cursor: grabbing !important; user-select: none; }
.table tbody tr.is-dragging { opacity: .45; background: var(--paper-2); }
.table-wrap { position: relative; }
.drop-line { position: absolute; left: 0; right: 0; height: 3px; margin-top: -1.5px; border-radius: 2px; background: var(--wine); pointer-events: none; z-index: 5; }
.drop-line::before { content: ""; position: absolute; left: 0; top: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--wine); }
.type-icon { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: var(--paper-2); color: var(--wine); flex: none; }

/* ---------- Dialogue de confirmation ---------- */
.dialog { width: min(440px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 14px; box-shadow: var(--shadow-2); color: var(--ink-soft); }
.dialog::backdrop { background: rgba(27, 22, 19, .55); backdrop-filter: blur(2px); }
.dialog[open] { animation: pop .18s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.dialog__body { padding: var(--s5); }
.dialog__body h2 { font: 600 1.5rem/1.2 var(--font-display); margin-bottom: var(--s2); }
.dialog__foot { display: flex; justify-content: flex-end; gap: var(--s3); padding: var(--s4) var(--s5); background: var(--paper); border-radius: 0 0 14px 14px; }

/* ---------- Aide ---------- */
.dialog--help { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
.dialog--help .dialog__foot { justify-content: space-between; align-items: center; position: sticky; bottom: 0; }
.help__body h3 { font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: var(--s5) 0 var(--s2); }
.help__summary { margin: 0; }
.help__list { margin: 0; padding-left: 1.25rem; display: grid; gap: var(--s2); }
.help__list--tips { list-style: none; padding-left: 0; }
.help__list--tips li { padding-left: var(--s3); border-left: 3px solid var(--line); }
details.help { border: 1px solid var(--line); border-radius: 10px; scroll-margin-top: 80px; }
details.help summary { padding: var(--s3) var(--s4); font-weight: 600; cursor: pointer; min-height: 44px; display: flex; align-items: center; }
details.help[open] summary { border-bottom: 1px solid var(--line); }
details.help > .help__body { padding: 0 var(--s4) var(--s4); }
.help__toc-group { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: var(--s4) 0 var(--s2); }
.help__toc-group:first-child { margin-top: 0; }
.help__toc { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1, 4px); }
.help__toc a { text-decoration: none; }
.help__toc a:hover { text-decoration: underline; }

/* ---------- Double authentification ---------- */
.steps-list { margin: 0; padding-left: 1.25rem; display: grid; gap: var(--s2); }
.qr-block { display: grid; gap: var(--s3); justify-items: start; }
.qr { width: 220px; max-width: 100%; padding: var(--s3); background: var(--white); border: 1px solid var(--line); border-radius: 12px; }
.qr svg { display: block; width: 100%; height: auto; }
.totp-secret { font-size: .9375rem; letter-spacing: .08em; word-break: break-all; }
.backup-codes { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s2); }
.backup-codes li { padding: 10px 14px; background: var(--paper); border: 1px dashed var(--line-strong); border-radius: 8px; text-align: center; }
.backup-codes code { font-size: 1.0625rem; letter-spacing: .06em; }

/* ---------- Connexion ---------- */
.login { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr); min-height: 100dvh; }
.login__brand { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: var(--s7); color: var(--white); background: linear-gradient(160deg, rgba(27, 22, 19, .88), rgba(90, 24, 34, .9)), url("/images/h1-slide-2.jpg") center / cover; overflow: hidden; }
.login__brand::after { content: ""; position: absolute; inset: auto -20% -30% auto; width: 70%; aspect-ratio: 1; border: 1px solid rgba(200, 164, 94, .35); border-radius: 50%; }
.login__logo { font: 600 2rem/1.1 var(--font-display); }
.login__logo em { color: var(--gold); }
.login__tagline { max-width: 14ch; font: 600 clamp(2.5rem, 5vw, 4rem)/1.05 var(--font-display); }
.login__tagline em { color: var(--gold); font-style: italic; }
.login__since { font-size: .75rem; letter-spacing: .24em; text-transform: uppercase; color: var(--gold-light); }
.login__panel { display: grid; place-items: center; padding: var(--s6); background: var(--paper); }
.login__card { width: min(100%, 400px); display: grid; gap: var(--s5); }
.login__card h1 { font: 600 2.25rem/1.1 var(--font-display); }
.login__card .lead { margin: 6px 0 0; color: var(--muted); }
.login__card form { display: grid; gap: var(--s4); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 52px !important; }
.password-wrap .icon-btn { position: absolute; right: 2px; top: 1px; height: 44px; }
.login__foot { font-size: .8125rem; color: var(--muted); }

/* ---------- Adaptation ---------- */
@media (max-width: 1023px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar { position: fixed; inset: 0 auto 0 0; width: min(86vw, var(--sidebar)); transform: translateX(-100%); visibility: hidden; transition: transform .25s var(--ease), visibility 0s .25s; box-shadow: var(--shadow-2); }
    .sidebar.is-open { transform: none; visibility: visible; transition: transform .25s var(--ease); }
    .scrim { position: fixed; inset: 0; z-index: 50; background: rgba(27, 22, 19, .5); opacity: 0; pointer-events: none; transition: opacity .25s var(--ease); }
    .scrim.is-open { opacity: 1; pointer-events: auto; }
    .icon-btn.menu-toggle { display: inline-grid; margin-left: calc(var(--s2) * -1); }
    .topbar { padding: 0 var(--s4); }
    .content { padding: var(--s5) var(--s4) var(--s7); }
    .form-actions { margin-inline: calc(var(--s4) * -1); padding-inline: var(--s4); margin-bottom: calc(var(--s7) * -1); }
    .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .login { grid-template-columns: minmax(0, 1fr); }
    .login__brand { min-height: 220px; padding: var(--s5); }
    .login__tagline { font-size: 2.25rem; max-width: none; }
    .login__since { display: none; }
    /* Tableaux : une carte par ligne */
    .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
    .table td { display: flex; justify-content: space-between; gap: var(--s4); padding: 6px 0; border: 0; }
    .table td[data-label]::before { content: attr(data-label); flex: none; font-size: .6875rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
    .table .cell-title { min-width: 0; display: block; }
    .table .cell-title::before { display: none; }
    .table .cell-actions { width: 100%; }
    .row-actions { justify-content: flex-start; }
    .toolbar { padding: var(--s4); }
    .pagination { padding: var(--s4); }
    .card__body { padding: var(--s4); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* --- Glisser-déposer des fichiers (cf. js/dropzone.js) --- */
.dropzone { position: relative; display: grid; place-items: center; min-height: 112px; padding: 20px; border: 1.5px dashed var(--line-strong); background: var(--paper); color: var(--ink); text-align: center; transition: border-color .2s, background-color .2s; }
.dropzone:hover { border-color: var(--ink-soft, var(--ink)); }
.dropzone:focus-within { border-color: var(--wine); box-shadow: 0 0 0 3px rgba(200, 164, 94, .45); }
.dropzone.is-dragging { border-style: solid; border-color: var(--wine); background: var(--white); }
.dropzone .dropzone__input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.dropzone .dropzone__input::file-selector-button { cursor: pointer; }
.dropzone__prompt { display: grid; gap: 4px; pointer-events: none; }
.dropzone__title { font-weight: 600; }
.dropzone__or { font-size: .875rem; color: var(--muted); }
.dropzone__browse { color: var(--wine); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.dropzone__status { margin: 0; font-size: .8125rem; color: var(--muted); }
.dropzone__status:empty { display: none; }
.dropzone__status.is-error { color: var(--danger); font-weight: 500; }
.dropzone__list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.dropzone__item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 1px solid var(--line); background: var(--white); }
.dropzone__thumb { flex: none; width: 48px; height: 48px; object-fit: cover; background: var(--paper); }
.dropzone__thumb--file { display: grid; place-items: center; font-size: .6875rem; font-weight: 700; letter-spacing: .06em; color: var(--wine); border: 1px solid var(--line); }
.dropzone__name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .875rem; }
.dropzone__size { flex: none; font-size: .8125rem; color: var(--muted); }
.dropzone__remove { flex: none; min-height: 44px; padding: 0 12px; border: 0; background: none; color: var(--wine); font: inherit; font-size: .8125rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.dropzone__remove:hover { color: var(--danger); }
@media (prefers-reduced-motion: reduce) { .dropzone { transition: none; } }

/* Diaporama : miniature de la photo dans la liste */
.slide-thumb { display: block; width: 128px; height: 72px; object-fit: cover; border-radius: 6px; background: var(--paper-2); }
