/* ------------------------------------------------------------------
   CalendarFB — feuille de style unique, sans framework.
------------------------------------------------------------------ */
:root {
    --bg:        #f4f5f7;
    --surface:   #ffffff;
    --border:    #e2e5ea;
    --text:      #1c2333;
    --muted:     #6b7280;
    --primary:   #2563eb;
    --primary-d: #1d4ed8;
    --danger:    #dc2626;
    --success:   #16a34a;
    --warning:   #d97706;
    --facebook:  #1877f2;
    --instagram: #e1306c;
    --radius:    10px;
    --shadow:    0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.1);
}

* { box-sizing: border-box; }

/* L'attribut hidden prime sur toute classe de mise en page : sans cette
   regle, un panneau replie qui porte .inline-fields (display:flex) reste
   affiche, car la classe l'emporte sur le style par defaut du navigateur. */
[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em;
       background: #eef1f5; padding: 1px 5px; border-radius: 4px; }
pre.code-block { background: #1c2333; color: #e8ecf3; padding: 12px; border-radius: var(--radius);
                 overflow-x: auto; font-size: 12px; white-space: pre-wrap; }

/* ---------- Structure ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 224px; flex: 0 0 224px; background: var(--surface);
    border-right: 1px solid var(--border); display: flex; flex-direction: column;
    padding: 18px 0; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 18px 18px; }
.brand-mark {
    width: 32px; height: 32px; border-radius: 8px; background: var(--primary);
    color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.brand-text { font-weight: 700; font-size: 15px; }
.brand-lg { justify-content: center; padding-bottom: 8px; }

.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.sidebar nav a {
    padding: 9px 12px; border-radius: 8px; color: var(--text);
    font-weight: 500; text-decoration: none;
}
.sidebar nav a:hover { background: #f0f2f6; }
.sidebar nav a.active { background: var(--primary); color: #fff; }

.sidebar-footer { margin-top: auto; padding: 14px 18px 0; border-top: 1px solid var(--border); }
.user-chip strong { display: block; font-size: 13px; }
.user-chip small { color: var(--muted); }
.logout { display: inline-block; margin-top: 8px; font-size: 13px; }

.content { flex: 1; padding: 22px 26px 60px; max-width: 1500px; }

/* ---------- Entetes ---------- */
.page-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.page-head h1 { margin: 0 0 2px; font-size: 22px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); margin: 0; }
.hint { margin-top: 14px; font-size: 13px; }
.text-danger { color: var(--danger); }

/* ---------- Cartes ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 12px; font-size: 15px; }
.card h3 { margin: 18px 0 8px; font-size: 14px; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush .card-title { padding: 14px 18px 0; }
.card-alert { border-color: #fca5a5; background: #fff7f7; }
.card-actions { margin-bottom: 0; }

/* ---------- Formulaires ---------- */
label { display: block; margin-bottom: 12px; font-weight: 500; }
label small { font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=url],
input[type=number], input[type=date], input[type=datetime-local], input[type=search],
select, textarea {
    width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit;
    border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(37,99,235,.35); outline-offset: 0; border-color: var(--primary);
}
input[type=color] { width: 52px; height: 34px; padding: 2px; }
textarea { resize: vertical; }
fieldset { border: 1px solid var(--border); border-radius: 8px; margin: 0 0 12px; padding: 10px 12px; }
legend { font-weight: 600; padding: 0 6px; }
.field-hint { color: var(--muted); font-size: 12.5px; margin: -6px 0 12px; }
.inline-fields { display: flex; gap: 12px; flex-wrap: wrap; }
.inline-fields > label { flex: 1 1 180px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.checkbox-row input { width: auto; margin: 0; }
.counter-row { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); margin: -8px 0 12px; }
.counter-row .over { color: var(--danger); font-weight: 600; }

.form-columns { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.form-main { flex: 1 1 560px; min-width: 0; }
/* La colonne de droite suit le defilement d'un seul bloc. Rendre
   « collante » une carte isolee ne suffit pas : la colonne est bien plus
   courte que le formulaire, donc elle sortirait de l'ecran avant la fin. */
.form-side {
    flex: 0 1 340px; min-width: 280px;
    position: sticky; top: 16px; align-self: flex-start;
    max-height: calc(100vh - 32px); overflow-y: auto;
}

/* ---------- Boutons ---------- */
.btn {
    display: inline-block; padding: 8px 13px; border-radius: 8px; border: 1px solid var(--border);
    background: #fff; color: var(--text); font: inherit; font-weight: 500; cursor: pointer;
    text-decoration: none; line-height: 1.2;
}
.btn:hover { background: #f4f6f9; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-danger { background: #fff; border-color: #fca5a5; color: var(--danger); }
.btn-danger:hover { background: #fef2f2; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-block { display: block; width: 100%; text-align: center; margin-bottom: 8px; }
.btn-xs { padding: 4px 9px; font-size: 12.5px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline { display: inline; }

/* ---------- Messages ---------- */
.flashes { margin-bottom: 14px; }
.flash {
    padding: 10px 14px; border-radius: 8px; margin-bottom: 8px;
    border: 1px solid transparent; font-size: 13.5px;
}
.flash-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash-error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.flash-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* ---------- Statistiques ---------- */
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px 16px; min-width: 110px; box-shadow: var(--shadow);
}
.stat-wide { min-width: 180px; }
.stat-value { display: block; font-size: 24px; font-weight: 700; line-height: 1.1; }
.stat-small { font-size: 15px; }
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat-alert { border-color: #fca5a5; background: #fff7f7; }
.stat-ok { border-color: #a7f3d0; }

/* ---------- Filtres ---------- */
.filter-bar {
    display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 10px 12px; margin-bottom: 16px;
}
.filter-bar select, .filter-bar input { width: auto; min-width: 160px; margin-top: 0; }

/* ---------- Calendrier ---------- */
.calendar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.calendar-head, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar-head > div {
    padding: 9px 10px; font-size: 12px; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 1px solid var(--border); background: #fafbfc;
}
.day {
    min-height: 148px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
    padding: 6px; display: flex; flex-direction: column; gap: 4px;
    /* Sans min-width, une case de grille ne descend jamais sous la
       largeur de son contenu : une legende un peu longue elargissait sa
       colonne et decalait toute la semaine. Les sept jours doivent
       garder la meme largeur, quoi qu'on y programme. */
    min-width: 0;
}
.day:nth-child(7n) { border-right: none; }
.day-out { background: #fafbfc; color: var(--muted); }
.day-today { background: #eff6ff; }
.day-today .day-num { background: var(--primary); color: #fff; border-radius: 999px; padding: 0 6px; }
.day-head { display: flex; justify-content: space-between; align-items: center; }
.day-num { font-size: 12.5px; font-weight: 600; }
.day-add { color: var(--muted); font-weight: 700; padding: 0 5px; border-radius: 5px; opacity: 0; }
.day:hover .day-add { opacity: 1; }
.day-add:hover { background: var(--primary); color: #fff; text-decoration: none; }
.day-body { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; min-height: 0; }
.day.drag-over { background: #dbeafe; outline: 2px dashed var(--primary); outline-offset: -3px; }

/* Deux lignes : l'entete (heure, type, destinations) puis la legende.
   Sur une seule ligne, les pastilles ne pouvant pas retrecir grignotaient
   toute la place et le texte disparaissait dans les colonnes etroites. */
.chip {
    display: flex; flex-direction: column; gap: 1px; padding: 3px 6px; border-radius: 6px;
    font-size: 11.5px; background: #f1f3f7; color: var(--text); text-decoration: none;
    border-left: 3px solid var(--chip-accent, var(--primary)); cursor: grab;
}
.chip-line { display: flex; align-items: center; gap: 5px; }
.chip:hover { background: #e7eaf1; text-decoration: none; }
.chip.dragging { opacity: .4; }
.chip[draggable="false"] { cursor: pointer; }
.chip-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.chip-badge { font-size: 9px; font-weight: 700; letter-spacing: .03em; color: var(--muted); }
/* Le texte prend la place restante ; les pastilles gardent la leur. */
.chip-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-published { background: #ecfdf5; }
.chip-failed    { background: #fef2f2; border-left-color: var(--danger); }
.chip-draft     { background: #f8fafc; opacity: .75; font-style: italic; }
.chip-cancelled { background: #f3f4f6; text-decoration: line-through; opacity: .6; }
.chip-story     { border-left-style: dotted; border-left-width: 4px; }

/* Destinations d'une meme saisie : « FB », « IG x2 », « +ST » pour la Story. */
.chip-tags { display: flex; gap: 3px; flex: 0 0 auto; margin-left: auto; }
.pill {
    font-size: 8.5px; font-weight: 700; letter-spacing: .02em; line-height: 1.6;
    padding: 0 4px; border-radius: 4px; white-space: nowrap;
}
.pill-facebook  { background: #e7edfb; color: #2c4b8f; }
.pill-instagram { background: #fce7f0; color: #a12a63; }
.pill-story     { background: #ede9fe; color: #5b3fa8; }
.chip-published .pill, .chip-cancelled .pill { opacity: .7; }

/* Une publication partielle ou en echec ne doit pas se cacher derriere
   la vignette groupee : elle est annoncee sous elle. */
.chip-note { font-size: 10px; color: var(--muted); padding: 0 6px 0 9px; }
.chip-note-alert { color: var(--danger); font-weight: 600; }

/* `.chip` est en display:flex : sans cette regle, l'attribut hidden
   des vignettes en reserve serait sans effet. */
.chip[hidden], .chip-note[hidden] { display: none; }

.day-more {
    align-self: flex-start; border: none; background: none; padding: 1px 4px;
    font: inherit; font-size: 10.5px; color: var(--muted); cursor: pointer; border-radius: 4px;
}
.day-more:hover { background: #e7eaf1; color: var(--text); }

/* ---------- Tableaux ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafbfc; }
.table tbody tr:hover { background: #fafbfc; }
.table-compact th, .table-compact td { padding: 6px 12px; font-size: 13px; }
.ta-right { text-align: right; }
.nowrap { white-space: nowrap; }
.cell-caption { max-width: 420px; }
.empty { padding: 24px; text-align: center; color: var(--muted); }
.error-note {
    margin-top: 5px; font-size: 12px; color: #991b1b; background: #fef2f2;
    border-radius: 6px; padding: 4px 8px;
}
.link-out { font-size: 12.5px; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: #eef1f5; }
.pill-scheduled  { background: #dbeafe; color: #1e40af; }
.pill-published  { background: #d1fae5; color: #065f46; }
.pill-failed     { background: #fee2e2; color: #991b1b; }
.pill-draft      { background: #f3f4f6; color: #4b5563; }
.pill-publishing { background: #fef3c7; color: #92400e; }
.pill-cancelled  { background: #f3f4f6; color: #6b7280; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; background: #eef1f5; font-size: 11.5px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; margin-right: 5px; }
.dot-lg { width: 14px; height: 14px; }

.pager { display: flex; gap: 5px; margin-top: 14px; flex-wrap: wrap; }
.pager a { padding: 5px 11px; border: 1px solid var(--border); border-radius: 7px; background: #fff; }
.pager a.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Medias ---------- */
.media-picker {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px; max-height: 340px; overflow-y: auto; padding: 4px;
    border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px;
}
.media-picker-sm { max-height: 200px; }
.media-tile {
    position: relative; margin: 0; border: 2px solid transparent; border-radius: 8px;
    overflow: hidden; cursor: pointer; background: #f1f3f7;
}
.media-tile.selected { border-color: var(--primary); }
.media-tile input { position: absolute; top: 5px; left: 5px; z-index: 2; width: auto; margin: 0; }
.media-tile img { display: block; width: 100%; height: 84px; object-fit: cover; }
.media-name { display: block; padding: 3px 5px; font-size: 10.5px; color: var(--muted);
              overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
.media-video { display: grid; place-items: center; height: 84px; background: #1c2333; color: #fff;
               font-size: 11px; font-weight: 700; letter-spacing: .06em; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.media-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.media-card img { display: block; width: 100%; height: 130px; object-fit: cover; }
.media-card .media-video { height: 130px; }
.media-meta { padding: 8px 10px; font-size: 12px; }
.media-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-meta form { margin-top: 6px; }

/* ---------- Comptes ---------- */
.account-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.account-card { margin-bottom: 0; }
.account-off { opacity: .6; }
.account-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.account-head > div { flex: 1; min-width: 0; }
.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: 0 0 38px; }
.avatar-blank { background: #e2e5ea; display: inline-block; }
.account-settings { margin: 10px 0; }
.account-list { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; }
.account-list-inline { flex-direction: row; flex-wrap: wrap; max-height: none; margin-bottom: 12px; }
.account-row {
    display: flex; align-items: center; gap: 8px; padding: 7px 9px; margin: 0;
    border: 1px solid var(--border); border-radius: 8px; font-weight: 400; cursor: pointer;
}
.account-row:hover { background: #f7f9fc; }
.account-row input { width: auto; margin: 0; }

.weekdays { display: flex; gap: 6px; flex-wrap: wrap; }
.weekday { display: flex; align-items: center; gap: 5px; margin: 0; padding: 6px 10px;
           border: 1px solid var(--border); border-radius: 8px; font-weight: 500; cursor: pointer; }
.weekday input { width: auto; margin: 0; }

.shift-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 0 0; }
.shift-form input[type=number] { width: 72px; margin: 0; }

.kv { margin: 0; }
.kv dt { font-weight: 600; font-size: 12.5px; color: var(--muted); }
.kv dd { margin: 0 0 10px; }
.tight-list { margin: 0; padding-left: 18px; }
.tight-list li { margin-bottom: 5px; }

.log-error td { background: #fef2f2; }
.log-warning td { background: #fffbeb; }
details summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
details pre { font-size: 11px; background: #f4f6f9; padding: 8px; border-radius: 6px; overflow-x: auto; }

/* ---------- Connexion ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; background: var(--bg); }
.login-card {
    width: 100%; max-width: 380px; background: var(--surface); padding: 30px;
    border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
}
.login-tagline { color: var(--muted); text-align: center; font-size: 13px; margin: 0 0 20px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; flex: none; height: auto; position: static; border-right: none;
               border-bottom: 1px solid var(--border); }
    .sidebar nav { flex-direction: row; flex-wrap: wrap; }
    .sidebar-footer { display: flex; justify-content: space-between; align-items: center; }
    .content { padding: 16px; }
    .form-side { position: static; max-height: none; overflow: visible; }
    .day { min-height: 96px; }
    .chip-text { display: none; }
}

/* ==================================================================
   Compositeur multi-plateformes
================================================================== */

/* ---------- Destinations ---------- */
.destination-group {
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 10px 12px; margin-bottom: 10px; background: #fafbfc;
}
.destination-group-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px; font-size: 13px;
}
.destination {
    display: flex; align-items: center; gap: 10px; margin: 0 0 6px;
    padding: 8px 10px; background: #fff; border: 1px solid var(--border);
    border-radius: 8px; font-weight: 400; cursor: pointer;
}
.destination:last-child { margin-bottom: 0; }
.destination:hover { border-color: var(--primary); }
.destination:has(input:checked) { border-color: var(--primary); background: #f5f8ff; }
.destination input { width: auto; margin: 0; flex: 0 0 auto; }
.destination-text { flex: 1; min-width: 0; }
.destination-text strong { display: block; font-size: 13.5px; }
.avatar-sm { width: 30px; height: 30px; flex: 0 0 30px; }

.platform-tag {
    display: inline-block; padding: 1px 7px; border-radius: 5px;
    font-size: 10.5px; font-weight: 700; letter-spacing: .04em; color: #fff;
}
.platform-facebook  { background: var(--facebook); }
.platform-instagram { background: var(--instagram); }

/* ---------- Bascules « Personnaliser… » ---------- */
.toggle-row {
    padding: 9px 12px; background: #f4f6f9; border-radius: 8px;
    margin-bottom: 14px; font-weight: 500;
}

/* ---------- Partager sur : Stories ---------- */
.story-row {
    align-items: flex-start; padding: 11px 13px; margin-bottom: 9px;
    border: 1px solid var(--border); border-radius: var(--radius); background: #fff;
    font-weight: 400; cursor: pointer;
}
.story-row:has(input:checked) { border-color: var(--instagram); background: #fff5f8; }
.story-row input { margin-top: 3px; }
.story-row-off { opacity: .5; cursor: not-allowed; }

/* ---------- Encadre explicatif ---------- */
.callout {
    padding: 11px 14px; border-radius: 8px; font-size: 13px;
    border: 1px solid var(--border); background: #fafbfc; margin-bottom: 14px;
}
.callout-ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }

/* ---------- Recapitulatif ---------- */
.summary-card { margin-bottom: 0; }
.summary-list { list-style: none; margin: 0 0 10px; padding: 0; }
.summary-list li {
    padding: 6px 0; font-size: 13px; border-bottom: 1px dashed var(--border);
    display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.summary-list li:last-child { border-bottom: none; }
.summary-story { padding-left: 14px !important; color: var(--muted); }
.summary-total {
    margin: 0; padding-top: 10px; border-top: 2px solid var(--border);
    font-weight: 700; font-size: 13.5px;
}

/* ---------- Apercu ---------- */
.preview { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.preview-head { display: flex; align-items: center; gap: 9px; padding: 10px 12px; }
.preview-head strong { font-size: 13.5px; }
.preview-media {
    position: relative; display: grid; place-items: center;
    min-height: 170px; background: #f1f3f7;
}
.preview-media img { display: block; width: 100%; max-height: 300px; object-fit: cover; }
.preview-count {
    position: absolute; top: 8px; right: 8px; padding: 2px 9px; border-radius: 999px;
    background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 600;
}
.preview-text {
    margin: 0; padding: 11px 12px; font-size: 13px; white-space: pre-wrap;
    word-break: break-word; max-height: 190px; overflow-y: auto;
}
.preview-actions {
    display: flex; justify-content: space-around; padding: 9px 12px;
    border-top: 1px solid var(--border); color: var(--muted);
    font-size: 12.5px; font-weight: 600;
}
.summary-actions { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.summary-actions .btn:last-child { margin-bottom: 0; }

/* ---------- Diagnostic (Reglages) ---------- */
.diagnostic { list-style: none; margin: 0 0 10px; padding: 0; }
.diagnostic li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.diagnostic li:last-child { border-bottom: none; }
.diagnostic li > span:last-child { flex: 1; min-width: 0; }
.diagnostic strong { display: block; font-size: 13.5px; }
.diagnostic small { display: block; word-break: break-word; }
.diag-mark { flex: 0 0 18px; text-align: center; font-weight: 700; }
.diag-fail .diag-mark { color: var(--danger); }
.diag-warn .diag-mark { color: var(--warning); }
.diag-fix { display: block; margin-top: 5px; padding: 6px 9px; border-radius: 6px;
            background: #fffbeb; color: #92400e; font-size: 12.5px; }

/* ---------- Permissions Meta manquantes ---------- */
.permissions { list-style: none; margin: 0 0 10px; padding: 0; }
.permissions li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.permissions li:last-child { border-bottom: none; }
.permission-fix { color: #92400e; }

/* ---------- Selecteur de medias ordonne ---------- */
.media-tile { position: relative; }
.media-rank {
    position: absolute; top: 5px; right: 5px; z-index: 2;
    min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
    background: var(--primary); color: #fff; font-size: 11.5px; font-weight: 700;
    display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.35);
}

.media-order {
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px 14px; margin-bottom: 12px; background: #fafbfc;
}
.media-order-head { display: flex; justify-content: space-between; align-items: baseline;
                    gap: 10px; margin-bottom: 10px; font-size: 13.5px; }
.media-order-list { list-style: none; margin: 0; padding: 0; display: flex;
                    flex-direction: column; gap: 6px; }
.media-order-item {
    display: flex; align-items: center; gap: 10px; padding: 6px 9px;
    background: #fff; border: 1px solid var(--border); border-radius: 8px; cursor: grab;
}
.media-order-item.dragging { opacity: .45; }
.media-order-item img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; flex: 0 0 44px; }
.media-order-item .media-video { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 6px; font-size: 9px; }
.media-order-rank {
    flex: 0 0 24px; height: 24px; border-radius: 999px; background: var(--primary);
    color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center;
}
.media-order-name { flex: 1; min-width: 0; font-size: 12.5px; overflow: hidden;
                    text-overflow: ellipsis; white-space: nowrap; }
.media-order-actions { display: flex; gap: 4px; flex: 0 0 auto; }
.media-order-actions .btn { padding: 3px 8px; line-height: 1.1; }
.media-order-actions .btn[disabled] { opacity: .35; cursor: not-allowed; }
