:root {
    /* Thème clair « façon LinkedIn » */
    --bg: #f4f2ee;
    --panel: #ffffff;
    --panel-2: #f3f2ef;
    --panel-3: #e9e6e0;
    --border: #d9d6cf;
    --border-soft: #e6e3dd;
    --text: #1b1b18;
    --muted: #5e5d59;
    --accent: #0a66c2;       /* bleu LinkedIn */
    --accent-2: #004182;     /* bleu foncé LinkedIn */
    --accent-grad: linear-gradient(135deg, #0a66c2, #004182);
    --teal: #057642;         /* vert LinkedIn */
    --danger: #b91c1c;
    --on-accent: #ffffff;    /* texte sur fond bleu */
    /* Couleurs sémantiques (déclinées en sombre plus bas) */
    --topbar-bg: rgba(255, 255, 255, .88);
    --accent-soft: #eef4fb;         /* survol dropzone, fonds bleutés doux */
    --info-bg: #eaf3fb;
    --info-border: #bcdcf5;
    --info-text: #0a66c2;
    --err-bg: #fdecea;
    --err-border: #f5c2c0;
    --err-text: #b3261e;
    --ok-bg: #e7f5ec;
    --ok-border: #b7e0c4;
    --ok-text: #0a5c2e;
    --warn-text: #8a6d1b;
    --skeleton-1: #eceae5;
    --skeleton-2: #f5f3ef;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(0,0,0,.08), 0 6px 20px -10px rgba(0,0,0,.20);
    --ring: 0 0 0 3px rgba(10, 102, 194, .22);
    color-scheme: light;
}

/* ---------- Thème sombre ----------
   Suit la préférence système par défaut ; forçable via [data-theme]. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #17191c;
        --panel: #202327;
        --panel-2: #262a2e;
        --panel-3: #31363b;
        --border: #3a4046;
        --border-soft: #2c3136;
        --text: #e9e7e3;
        --muted: #a4a29c;
        --accent: #4c9fe6;
        --accent-2: #2f7fca;
        --accent-grad: linear-gradient(135deg, #2f7fca, #1c5aa0);
        --teal: #4ec27d;
        --danger: #ef6a6a;
        --on-accent: #ffffff;
        --topbar-bg: rgba(28, 31, 35, .85);
        --accent-soft: #17324c;
        --info-bg: #142d44;
        --info-border: #245080;
        --info-text: #8ec4f2;
        --err-bg: #3a1f1f;
        --err-border: #6a2f2f;
        --err-text: #f2a3a0;
        --ok-bg: #17321f;
        --ok-border: #2e5c3c;
        --ok-text: #8fd6a8;
        --warn-text: #d9b45c;
        --skeleton-1: #262a2e;
        --skeleton-2: #31363b;
        --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -10px rgba(0,0,0,.6);
        --ring: 0 0 0 3px rgba(76, 159, 230, .32);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #17191c;
    --panel: #202327;
    --panel-2: #262a2e;
    --panel-3: #31363b;
    --border: #3a4046;
    --border-soft: #2c3136;
    --text: #e9e7e3;
    --muted: #a4a29c;
    --accent: #4c9fe6;
    --accent-2: #2f7fca;
    --accent-grad: linear-gradient(135deg, #2f7fca, #1c5aa0);
    --teal: #4ec27d;
    --danger: #ef6a6a;
    --on-accent: #ffffff;
    --topbar-bg: rgba(28, 31, 35, .85);
    --accent-soft: #17324c;
    --info-bg: #142d44;
    --info-border: #245080;
    --info-text: #8ec4f2;
    --err-bg: #3a1f1f;
    --err-border: #6a2f2f;
    --err-text: #f2a3a0;
    --ok-bg: #17321f;
    --ok-border: #2e5c3c;
    --ok-text: #8fd6a8;
    --warn-text: #d9b45c;
    --skeleton-1: #262a2e;
    --skeleton-2: #31363b;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -10px rgba(0,0,0,.6);
    --ring: 0 0 0 3px rgba(76, 159, 230, .32);
    color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

.muted { color: var(--muted); font-weight: 400; }

/* ---------- Header ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 28px;
    background: var(--topbar-bg);
    /* Flou retiré : la barre est déjà opaque à 88 %, le filtre ne se voyait
       pas et faisait travailler le GPU en continu. */
    border-bottom: 1px solid var(--border);
}
.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: .2px;
}
.brand .logo {
    display: grid;
    place-items: center;
    width: 30px; height: 30px;
    border-radius: 7px;
    background: var(--accent);
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -.5px;
    box-shadow: 0 2px 8px -2px rgba(10, 102, 194, .5);
}
.brand-sub { color: var(--muted); font-weight: 600; }
/* La marque ramène à l'accueil de la Natasuite (accueil.html, la racine du site). */
.brand-lien { display: flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; min-height: 40px; }
.brand-lien:hover .brand-sub { color: var(--text); }
/* Lien de retour vers la suite qui a ouvert la session (Camosuite…). */
.brand .suite-retour {
    color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600;
    padding: 4px 9px; border-radius: 8px; border: 1px solid var(--border); margin-right: 4px;
}
.brand .suite-retour:hover { color: var(--text); background: var(--panel-2); }
/* Dans un cadre (la Camosuite) : la suite hôte porte déjà le retour et la
   déconnexion. */
html.ltb-integre .brand .suite-retour,
html.ltb-integre .topnav #logout { display: none; }
/* Et toute la barre « Tools » avec eux : dans le cadre, la suite hôte a
   déjà la sienne. Il ne reste que l'outil. */
html.ltb-integre .topbar { display: none; }

/* Onglets d'outils */
.tabs { display: flex; align-items: center; gap: 6px; }
.tab {
    color: var(--muted);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 9px;
    border: 1px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
}
.tab:hover { color: var(--text); background: var(--panel-2); }
.tab.active { color: #fff; background: var(--accent-2); border-color: var(--accent); }

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

/* Sous-onglets d'un outil (ex. Studio : Preset client / Studio libre) */
.subtabs-wrap { max-width: 1320px; margin: 0 auto; padding: 18px 28px 0; }
.subtabs {
    display: inline-flex;
    gap: 4px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
}
.subtab {
    padding: 7px 16px;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    transition: background .15s, color .15s;
}
.subtab:hover { color: var(--text); }
.subtab.active { background: var(--accent-2); color: #fff; }
.subtabs-wrap + .layout { padding-top: 16px; }

@media (max-width: 760px) {
    .topbar { flex-wrap: wrap; gap: 8px; }
    .tabs { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
    .tabs::-webkit-scrollbar { display: none; }
    .tab { flex: none; white-space: nowrap; padding: 7px 11px; }
}

/* ---------- Outil mise en forme ---------- */
.layout-fmt {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 22px;
    padding: 24px 28px 60px;
    max-width: 1320px;
    margin: 0 auto;
    align-items: start;
}
@media (max-width: 900px) { .layout-fmt { grid-template-columns: 1fr; } }

.fmt-h2 { margin: 0 0 4px; font-size: 18px; }
/* Sous-titre d'outil, commun à toutes les pages (Images, Studio, Emoji, Mise en forme, Admin). */
.section-sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.fmt-toolbar {
    display: flex; flex-wrap: wrap; gap: 7px;
    margin: 14px 0 12px;
}
.fmt-btn {
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 8px 11px;
    font-size: 14px;
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .1s;
}
.fmt-btn:hover { border-color: var(--accent); background: var(--panel-3); transform: translateY(-1px); }

.fmt-actions-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
/* Pousse les actions de nettoyage (Enlever la mise en forme, Effacer) à droite,
   séparées des actions additives (listes) car leur usage est inverse. */
.fmt-actions-spacer { flex: 1 1 auto; min-width: 8px; }
@media (max-width: 900px) { .fmt-actions-spacer { display: none; } }
.btn-sm { padding: 7px 12px; font-size: 13px; }

.fmt-editor {
    width: 100%;
    min-height: 280px;
    font-size: 15px;
    line-height: 1.6;
}
.fmt-foot {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-top: 12px;
}
.fmt-count { color: var(--muted); font-size: 13px; }
.fmt-count.over { color: var(--danger); font-weight: 700; }

.sym-group { margin-bottom: 16px; }
.sym-title {
    font-size: 12px; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: .3px; margin-bottom: 8px;
}
.sym-row { display: flex; flex-wrap: wrap; gap: 6px; }
.sym-chip {
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    min-width: 38px;
    padding: 7px 9px;
    font-size: 16px;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color .15s, transform .1s;
}
.sym-chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.navlink {
    color: var(--muted);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: 8px;
    transition: background .15s, color .15s;
}
.navlink:hover { color: var(--text); background: var(--panel-2); }
.navlink.as-btn { background: none; border: none; cursor: pointer; font-family: inherit; }

/* ---------- Layout ---------- */
.layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 22px;
    padding: 24px 28px 60px;
    max-width: 1320px;
    margin: 0 auto;
    align-items: start;
}
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
}
.result.panel { position: sticky; top: 78px; }
@media (max-width: 900px) {
    .result.panel { position: static; }
}

/* ---------- Form controls ---------- */
.field { margin-bottom: 16px; }
.field-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: .2px;
    margin-bottom: 7px;
    color: var(--muted);
}
/* Deux colonnes seulement si chacune garde 200 px : dans le panneau de
   commandes (400 px), deux menus côte à côte coupaient leurs libellés
   (« Proportions de la p… », « Nano Banana Pro –… »). */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
/* Sous 560 px, deux colonnes coupent les libellés d'option au milieu d'un mot. */
@media (max-width: 560px) {
    .grid-2 { grid-template-columns: 1fr; }
}

textarea, select, input[type="text"], input[type="password"] {
    width: 100%;
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    font-family: inherit;
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.5; }
textarea::placeholder, input::placeholder { color: var(--muted); }
textarea:focus, select:focus, input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--ring);
}
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235e5d59' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}
.hint { display: block; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
/* Format personnalisé : largeur × hauteur sous le menu Format. */
.format-perso { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.format-perso input[type="number"] { width: 92px; flex: 0 0 auto; }
.format-perso-x { color: var(--muted); }
.format-perso-etat { font-size: 11.5px; color: var(--muted); }
.format-perso-etat.is-ko { color: var(--danger); }

/* Dropzone */
.dropzone {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 116px;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--panel-2);
    color: var(--muted);
    cursor: pointer;
    overflow: hidden;
    transition: border-color .15s, background .15s;
    font-size: 13px;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.drag { border-style: solid; transform: scale(1.01); }
.dropzone img { max-width: 100%; max-height: 190px; border-radius: 8px; }
.ref-clear {
    position: absolute; top: 8px; right: 8px;
    width: 26px; height: 26px;
    border: none; border-radius: 50%;
    background: rgba(0, 0, 0, .65); color: #fff;
    cursor: pointer; font-size: 12px;
}

/* Switch toggle */
.switch {
    display: flex; align-items: center; gap: 11px;
    cursor: pointer;
    margin: 6px 0 18px;
    font-size: 13px;
    user-select: none;
}
/* « display: none » retirait les vingt-trois interrupteurs du Studio de la
   tabulation ET de l'arbre d'accessibilité : ils devenaient des phrases dont
   on ne savait ni l'état ni qu'elles étaient réglables. On les masque à l'œil
   sans les retirer du clavier. */
.switch input {
    position: absolute;
    width: 1px; height: 1px;
    margin: 0; padding: 0; border: 0;
    opacity: 0;
    pointer-events: none;
}
.switch input:focus-visible + .switch-track {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.switch-track {
    position: relative;
    width: 40px; height: 22px;
    background: var(--panel-3);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: background .2s;
    flex: 0 0 auto;
}
.switch-track::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform .2s, background .2s;
}
.switch input:checked + .switch-track { background: var(--accent-2); border-color: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); background: #fff; }
.switch-track::after { box-shadow: 0 1px 2px rgba(0,0,0,.2); }
/* Groupe de switches empilés dans un champ (resserre les marges par défaut). */
.switch-stack .switch { margin: 4px 0 10px; }
.switch input:disabled + .switch-track { opacity: .45; }
.switch input:disabled ~ .switch-label { opacity: .55; }

/* Buttons */
.btn-primary, .btn-secondary, .btn-ghost {
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    text-decoration: none;
    transition: transform .12s, box-shadow .15s, background .15s, border-color .15s, opacity .15s;
}
.btn-primary {
    background: var(--accent-grad);
    color: #fff;
    border: none;
    padding: 13px 18px;
    box-shadow: 0 8px 22px -8px rgba(43, 138, 237, .7);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 26px -8px rgba(43, 138, 237, .85); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .55; cursor: progress; transform: none; box-shadow: none; }
.btn-block { width: 100%; }

.btn-secondary {
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 9px 14px;
}
.btn-secondary:hover { border-color: var(--accent); background: var(--panel-3); }
.btn-ghost {
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
    padding: 9px 12px;
}
.btn-ghost:hover { color: var(--text); }

/* Coût d'un appel d'IA, écrit sur le bouton qui le lance (window.Couts.lier,
   auth.js) : « Générer · 0,034 $ ». Le libellé du bouton peut changer pendant
   la génération, le coût reste — il vit dans l'attribut data-cout. */
[data-cout]::after {
    content: "· " attr(data-cout);
    margin-left: .4em;
    font-weight: 500;
    opacity: .85;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.btn-primary[data-cout]::after, .btn-secondary[data-cout]::after, .btn-ghost[data-cout]::after { margin-left: 0; }

/* Cost row */
/* La ligne de coût : ce que coûte le prochain clic, à gauche ; ce qui a été
   dépensé aujourd'hui, à droite. Une seule ligne, les montants en gras, les
   libellés discrets — elle repliait son texte sur deux lignes dans le panneau. */
.cost-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
    padding: 7px 11px;
    background: var(--panel-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}
.cost-row > span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cost-row b { color: var(--text); font-weight: 700; font-size: 13px; }
.cost-est::before { content: '◷ '; color: var(--teal); }
.cost-total { text-align: right; }

/* Status */
.status {
    margin: 12px 0 0;
    font-size: 13px;
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    background: var(--panel-2);
    border: 1px solid var(--border-soft);
}
.status-top { margin: 0 0 14px; }
.status.err { background: var(--err-bg); border-color: var(--err-border); color: var(--err-text); }
.status.loading {
    background: var(--info-bg); border-color: var(--info-border); color: var(--info-text);
    display: flex; align-items: center; gap: 9px;
}
.status.loading::before {
    content: '';
    width: 14px; height: 14px;
    border: 2px solid currentColor; border-top-color: transparent;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Result ---------- */
/* L'attribut [hidden] doit toujours masquer, même quand une règle auteur
   (.placeholder display:flex, etc.) définit un display — sinon l'élément reste
   visible alors que le JS le masque (le placeholder restait sous l'image). */
[hidden] { display: none !important; }

.placeholder {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 12px;
    min-height: 360px;
    color: var(--muted);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
}
.ph-icon { font-size: 40px; opacity: .65; }

.result-frame {
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--panel-2);
    box-shadow: var(--shadow);
}
#resultImg { width: 100%; display: block; }

.result-actions {
    display: flex; gap: 9px; flex-wrap: wrap;
    margin-top: 14px;
}
.btn-mt { margin-top: 9px; }

.alt-box {
    margin-top: 12px;
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    background: var(--info-bg);
    border: 1px solid var(--info-border);
}
.alt-box p { margin: 0 0 8px; color: var(--info-text); font-size: 13.5px; }

.prompt-box { margin-top: 14px; font-size: 13px; color: var(--muted); }
.prompt-box summary { cursor: pointer; padding: 4px 0; }
.prompt-box summary:hover { color: var(--text); }
.prompt-box p {
    margin-top: 8px;
    background: var(--panel-2);
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    color: var(--text);
    border: 1px solid var(--border-soft);
    line-height: 1.55;
}

.gallery-head {
    margin: 22px 0 10px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: .3px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.gallery-clear {
    font-size: 12px;
    padding: 4px 10px;
    text-transform: none;
    letter-spacing: 0;
}
.gallery-clear:hover { color: var(--danger); }
.gallery {
    display: grid;
    /* 15 vignettes au plus dans l'outil : elles peuvent être plus grandes. */
    grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
    gap: 10px;
}
.gthumb { position: relative; }
.gthumb img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;          /* image entière, sans recadrage */
    background: var(--panel-2);    /* comble le carré autour de l'image */
    border-radius: 9px;
    border: 1px solid var(--border);
    cursor: pointer;
    display: block;
    transition: border-color .15s, transform .12s;
}
.gthumb img:hover { border-color: var(--accent); transform: translateY(-2px); }
.gthumb-del {
    position: absolute; top: -5px; right: -5px;
    width: 20px; height: 20px;
    border: none; border-radius: 50%;
    background: var(--danger); color: #fff;
    cursor: pointer; font-size: 10px; line-height: 1;
    opacity: 0; transition: opacity .15s;
}
.gthumb:hover .gthumb-del { opacity: 1; }
/* Vue admin des historiques : qui a produit l'image, et les vidéos sans vignette. */
.gthumb-owner {
    position: absolute; left: 4px; bottom: 4px; max-width: calc(100% - 8px);
    padding: 1px 6px; border-radius: 999px; font-size: 10px; font-weight: 600;
    background: var(--panel-3); color: var(--text); border: 1px solid var(--border);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none;
}
.gthumb-video {
    width: 100%; aspect-ratio: 1; display: grid; place-items: center; font-size: 28px;
    background: var(--panel-2); border-radius: 9px; border: 1px solid var(--border); cursor: pointer;
}
.hist-filtres { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.hist-filtres select { max-width: 280px; }

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    background: var(--panel-3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 11px 18px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Mise à jour (admin) ---------- */
.version-info { margin-bottom: 14px; }
.version-current { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.version-badge {
    background: var(--accent-grad);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    padding: 4px 11px;
    border-radius: 999px;
}
.version-meta { color: var(--muted); font-size: 13px; }
.version-history { margin-top: 10px; font-size: 13px; color: var(--muted); }
.version-history summary { cursor: pointer; }
.version-history ul { margin: 8px 0 0; padding-left: 18px; }
.version-history li { margin: 3px 0; color: var(--text); }

.update-result {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    border: 1px solid var(--border);
}
.update-result.ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text); }
.update-result.err { background: var(--err-bg); border-color: var(--err-border); color: var(--err-text); }
.update-result ul { margin: 8px 0 0; padding-left: 18px; }
.update-result summary { cursor: pointer; margin-top: 6px; }
.update-result a.btn-sm { color: var(--accent); }

/* ---------- Changelog ---------- */
.changelog { display: flex; flex-direction: column; gap: 18px; }
.cl-entry {
    border-left: 2px solid var(--border);
    padding-left: 16px;
}
.cl-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cl-items { margin: 0; padding-left: 18px; }
.cl-items li { margin: 4px 0; font-size: 13.5px; color: var(--text); }

/* ---------- Pied de page (version) ---------- */
.appfoot {
    text-align: center;
    color: var(--muted);
    font-size: 11.5px;
    padding: 14px 0 26px;
    opacity: .7;
}

/* ---------- Connexion overlay ---------- */
.auth-overlay {
    position: fixed; inset: 0;
    background: rgba(20, 20, 18, .45);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
}
.auth-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px;
    width: 340px; max-width: 90vw;
    display: flex; flex-direction: column; gap: 13px;
    box-shadow: var(--shadow);
}
.auth-card h2 { margin: 0; font-size: 20px; }
.auth-err { color: var(--danger); font-size: 13px; margin: 0; }
.auth-warn { color: var(--warn-text); font-size: 12px; margin: 0; }

/* ---------- Admin ---------- */
.admin {
    max-width: 920px;
    margin: 0 auto;
    padding: 26px 28px 60px;
    display: flex; flex-direction: column; gap: 22px;
}
/* Navigation latérale de l'admin : un onglet par service. */
.admin-wrap {
    display: grid;
    grid-template-columns: 210px 1fr;
    gap: 22px;
    max-width: 1150px;
    margin: 0 auto;
    padding: 26px 28px 60px;
    align-items: start;
}
.admin-wrap .admin { max-width: none; margin: 0; padding: 0; min-width: 0; }
.admin-nav {
    position: sticky;
    top: 78px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--panel);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 8px;
    box-shadow: var(--shadow);
}
.admin-nav button, .admin-nav a {
    text-align: left;
    padding: 10px 12px;
    border-radius: 8px;
    border: none;
    background: none;
    color: var(--muted);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.admin-nav button:hover, .admin-nav a:hover { color: var(--text); background: var(--panel-2); }
.admin-nav .active { background: var(--accent-2); color: #fff; }
.admin-nav .active:hover { background: var(--accent-2); color: #fff; }
.admin-nav .nav-sep { border-top: 1px solid var(--border-soft); border-radius: 0 0 8px 8px; margin-top: 4px; }
.admin-pane { display: flex; flex-direction: column; gap: 22px; }
.admin-pane[hidden] { display: none; }
#secWarn { margin-bottom: 22px; }
#secWarn[hidden] { margin: 0; }
@media (max-width: 760px) {
    .admin-wrap { grid-template-columns: 1fr; }
    .admin-nav { position: static; flex-direction: row; overflow-x: auto; }
    .admin-nav .nav-sep { border-top: none; margin-top: 0; border-radius: 8px; }
    .admin-nav button, .admin-nav a { white-space: nowrap; }
}

/* Mots-clés personnalisés de l'outil Emoji */
.kw-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.kw-row-admin { display: flex; align-items: center; gap: 10px; }
.kw-row-admin .kw-emoji {
    flex: 0 0 34px;
    font-size: 26px; line-height: 1; text-align: center;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.kw-row-admin input { flex: 1; min-width: 0; }
.kw-new {
    display: flex; gap: 8px; align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 14px;
}
.kw-new .kw-emoji-input {
    flex: 0 0 64px; width: 64px; text-align: center; font-size: 18px;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.kw-new input:not(.kw-emoji-input) { flex: 1; min-width: 0; }

/* Comptes invités (admin → Accès) */
.user-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
/* Fournisseurs d'images (admin) : une carte par fournisseur, et les suites sœurs. */
.fournisseurs { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 8px; }
.fournisseur { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--panel-2); }
.fournisseur-tete { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fournisseur-etat { margin-left: auto; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px;
    border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.fournisseur-etat.is-ok  { color: #1b8f4e; border-color: currentColor; }
.fournisseur-etat.is-bad { color: var(--danger); border-color: currentColor; }
.fournisseur-actions { display: flex; gap: 6px; flex-wrap: wrap; }
/* Le crédit restant chez le fournisseur (fal.ai le dit, pas les autres). */
.fournisseur-solde { font-size: 12px; font-weight: 600; color: var(--text); }
.suite-card { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: baseline; padding: 10px 12px; margin-bottom: 8px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2); }
/* Suite modifiable (⚙ Accès) : en-tête sur une ligne, cases d'outils dessous. */
.suite-card.is-edit { flex-direction: column; align-items: stretch; gap: 10px; }
.suite-head { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; }
.suite-head a { font-size: 12.5px; }
.user-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 13px;
    display: flex; flex-direction: column; gap: 10px;
}
.user-head { display: flex; gap: 10px; flex-wrap: wrap; }
.user-head input { flex: 1; min-width: 180px; }
.tool-checks { display: flex; gap: 16px; flex-wrap: wrap; }
.tool-checks label {
    display: flex; align-items: center; gap: 7px;
    font-size: 13.5px; cursor: pointer; color: var(--text);
}
.tool-checks input { width: auto; accent-color: var(--accent); }
.user-actions { display: flex; gap: 8px; }
.user-opts { display: flex; gap: 8px; flex-wrap: wrap; }
.user-opts select { width: auto; flex: 0 0 auto; }
.user-opts input { flex: 1; min-width: 170px; }
.user-usage { font-size: 12.5px; color: var(--muted); }
.user-card .is-off { opacity: .45; pointer-events: none; }
.admin h2 {
    margin: 0 0 4px; font-size: 18px;
    display: flex; align-items: center; gap: 9px;
}
.admin h3 { margin: 0 0 12px; font-size: 15px; }

.client-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 22px; }
.client-card {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    transition: border-color .15s;
}
.client-card.is-default { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.client-head { display: flex; gap: 10px; align-items: center; margin-bottom: 11px; }
.client-name {
    flex: 1;
    font-size: 15px !important;
    font-weight: 600;
}
.client-brief { margin-bottom: 10px; }
.client-colors { margin-bottom: 12px; }

.default-pick {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12.5px; font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    padding: 7px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    white-space: nowrap;
    transition: all .15s;
}
.default-pick input { display: none; }
.default-pick:hover { color: var(--text); }
.default-pick.active { color: #fff; background: var(--accent-2); border-color: var(--accent); }

.client-delete { color: var(--danger) !important; }
.client-delete:hover { background: var(--err-bg) !important; border-color: var(--err-border) !important; }

.photo-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
/* Studio : espace la rangée de vignettes du dropzone au-dessus. */
#photoList { margin-top: 10px; }
#photoList:empty { margin-top: 0; }
.thumb { position: relative; width: 88px; height: 88px; }
.thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 9px;
    border: 1px solid var(--border);
}
.thumb-del {
    position: absolute; top: -6px; right: -6px;
    width: 22px; height: 22px;
    border: none; border-radius: 50%;
    background: var(--danger); color: #fff;
    cursor: pointer; font-size: 11px; line-height: 1;
}
.photo-empty { color: var(--muted); font-size: 12.5px; padding: 6px 0; }

.client-actions { display: flex; gap: 10px; }
.upload-btn { cursor: pointer; }

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

/* ---------- Bascule de thème ---------- */
.theme-toggle {
    display: inline-grid;
    place-items: center;
    width: 34px; height: 34px;
    padding: 0;
    font-size: 15px;
    line-height: 1;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .15s;
}
.theme-toggle:hover { border-color: var(--accent); transform: translateY(-1px); }
.theme-toggle .ti { transition: transform .3s ease; }
.theme-toggle:active .ti { transform: rotate(-30deg) scale(.9); }

/* ---------- Détails techniques d'un échec ---------- */
.error-details {
    margin: 10px 0 0;
    border: 1px solid var(--err-border);
    border-radius: var(--radius-sm);
    background: var(--err-bg);
    padding: 8px 12px;
    font-size: 12.5px;
}
.error-details summary { cursor: pointer; color: var(--err-text); font-weight: 600; }
.error-details pre {
    margin: 10px 0 6px;
    padding: 10px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 11.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 260px;
    overflow: auto;
    color: var(--text);
}

/* ---------- Journal des échecs (admin) ---------- */
.fail-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.fail-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 11px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12.5px;
}
.fail-chip b { color: var(--err-text); }
.fail-list { display: flex; flex-direction: column; gap: 8px; }
.fail-row {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: var(--panel-2);
    padding: 9px 12px;
    font-size: 12.5px;
}
.fail-row .fail-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fail-reason {
    font-weight: 700; color: var(--err-text);
    background: var(--err-bg); border: 1px solid var(--err-border);
    padding: 1px 8px; border-radius: 6px; font-size: 11.5px;
}
.fail-meta { color: var(--muted); font-size: 11.5px; }
.fail-row pre {
    margin: 8px 0 0; padding: 8px; font-size: 11px; line-height: 1.5;
    background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
    white-space: pre-wrap; word-break: break-word; max-height: 120px; overflow: auto;
}

/* ---------- Focus visible (clavier) ---------- */
:focus-visible {
    outline: none;
    box-shadow: var(--ring);
    border-radius: 6px;
}

/* ---------- Skeleton de chargement (zone résultat) ---------- */
.placeholder.is-loading {
    border-style: solid;
    border-color: var(--border-soft);
    background: linear-gradient(100deg, var(--skeleton-1) 30%, var(--skeleton-2) 50%, var(--skeleton-1) 70%);
    background-size: 200% 100%;
    animation: shimmer 1.3s ease-in-out infinite;
    color: transparent;
}
.placeholder.is-loading .ph-icon { color: var(--muted); opacity: .5; animation: pulse 1.3s ease-in-out infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse { 50% { opacity: .2; } }

/* Apparition douce des images (résultat + vignettes) */
.result-frame img, .gthumb img { animation: fade-in .35s ease both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } }

/* ---------- Respect de prefers-reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* ==================== Studio libre Vidéo (fiche guidée) ==================== */
/* Recettes */
.recipe-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.recipe-card { display: flex; flex-direction: column; gap: 3px; text-align: left;
    padding: 10px 11px; background: var(--panel-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer; font: inherit; color: var(--text);
    transition: border-color .15s, transform .12s; }
.recipe-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.recipe-card.is-active { border-color: var(--accent); background: var(--accent-soft); }
.rc-emoji { font-size: 17px; }
.rc-name { font-size: 13px; font-weight: 600; }
.rc-tag { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
@media (max-width: 520px) { .recipe-grid { grid-template-columns: 1fr; } }

/* Sections repliables de la fiche */
.fiche-sec { border-top: 1px solid var(--border-soft); padding: 12px 0; }
.fiche-sec[open] { padding-bottom: 4px; }
.sec-head { cursor: pointer; font-size: 13px; font-weight: 600; display: flex;
    align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sec-head:hover { color: var(--accent); }
.sec-recap { font-size: 11.5px; font-weight: 400; color: var(--muted); }
.fiche-sec > *:not(summary) { margin-top: 12px; }
/* Réglages avancés d'un formulaire (Preset, Studio) : repliés par défaut,
   bornés en haut et en bas, le titre résume leur état (sec-recap). */
.reglages-avances { border-bottom: 1px solid var(--border-soft); margin: 4px 0 16px; }
/* Titres de parties d'un formulaire (Studio : Modèle, Photos et prompt, Rendu). */
.form-sec {
    margin: 18px 0 10px;
    padding-top: 14px;
    border-top: 1px solid var(--border-soft);
    font-size: 12px; font-weight: 700;
    letter-spacing: .04em; text-transform: uppercase;
    color: var(--muted);
}
h3.form-sec:first-of-type { margin-top: 4px; padding-top: 0; border-top: 0; }

/* Contrôles segmentés (durée, qualité, modes) */
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--panel-2);
    border: 1px solid var(--border); border-radius: 10px; flex-wrap: wrap; }
.seg-btn { padding: 6px 11px; border: none; background: none; border-radius: 7px;
    font: inherit; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.seg-btn:hover { color: var(--text); }
.seg-btn.is-on { background: var(--accent-2); color: #fff; }
.seg-btn:disabled { opacity: .45; cursor: not-allowed; }

/* Avertissements en direct */
.warnbox { display: flex; flex-direction: column; gap: 8px; margin: 0 0 16px; }
.warn-item { display: flex; align-items: flex-start; gap: 8px; padding: 9px 11px;
    background: var(--panel-2); border: 1px solid var(--border-soft);
    border-left: 3px solid var(--warn-text); border-radius: var(--radius-sm);
    font-size: 12.5px; line-height: 1.4; }
.warn-item .btn-sm { flex: 0 0 auto; margin-left: auto; }

/* Aperçu du prompt et fiche technique */
.prompt-preview { white-space: pre-wrap; word-break: break-word; font-size: 12.5px;
    line-height: 1.5; background: var(--panel-2); border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm); padding: 10px 12px; margin: 0; }
.spec-list { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }
.seed-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seed-row input { flex: 1; min-width: 120px; }
.seed-row .switch { margin: 0; }

/* Fiche d'une image d'archive : l'image en grand, ses caractéristiques et la
   consigne qui l'a produite. Ouverte au clic sur une vignette d'historique. */
.apercu { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center;
    justify-content: center; padding: 24px; background: rgba(10, 12, 16, .72);
    backdrop-filter: blur(3px); }
.apercu-boite { display: flex; flex-direction: column; width: min(1040px, 100%);
    max-height: 100%; background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: 0 24px 60px rgba(0, 0, 0, .35); overflow: hidden; }
.apercu-tete { display: flex; align-items: center; gap: 12px; padding: 14px 16px;
    border-bottom: 1px solid var(--border-soft); }
.apercu-tete h3 { margin: 0; font-size: 15px; font-weight: 600; flex: 1;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apercu-corps { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 18px; padding: 16px; overflow: auto; }
.apercu-image { display: flex; align-items: center; justify-content: center;
    padding: 10px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
    background-image:
        linear-gradient(45deg, var(--panel-3) 25%, transparent 25%),
        linear-gradient(-45deg, var(--panel-3) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--panel-3) 75%),
        linear-gradient(-45deg, transparent 75%, var(--panel-3) 75%);
    background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0; }
.apercu-image img { max-width: 100%; max-height: 62vh; display: block; border-radius: 4px; }
.apercu-infos { min-width: 0; }
.apercu-infos h4 { margin: 16px 0 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.apercu-liste { display: grid; grid-template-columns: auto minmax(0, 1fr);
    gap: 4px 14px; margin: 0; font-size: 12.5px; }
.apercu-liste dt { color: var(--muted); }
.apercu-liste dd { margin: 0; word-break: break-word; }
.apercu-prompt { white-space: pre-wrap; word-break: break-word; font-size: 12px;
    line-height: 1.5; margin: 0 0 8px; padding: 10px 12px; max-height: 34vh; overflow: auto;
    background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); }
.apercu-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
@media (max-width: 820px) {
    .apercu { padding: 10px; }
    .apercu-corps { grid-template-columns: 1fr; }
    .apercu-image img { max-height: 38vh; }
}

/* Images jointes à une génération, dans la fiche d'archive */
.apercu-refs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 4px; }
.apercu-refs a { display: block; line-height: 0; border: 1px solid var(--border);
    border-radius: var(--radius-sm); overflow: hidden; background: var(--panel-3); }
.apercu-refs img { width: 84px; height: 84px; object-fit: cover; display: block; }
.apercu-refs a:hover { border-color: var(--accent); }

/* Damier de transparence — définition unique, utilisée par le Pixel art et la
   Palosuite, qui en avaient chacun leur copie (déjà divergentes). */
.damier {
    background-image:
        linear-gradient(45deg, var(--panel-3) 25%, transparent 25%),
        linear-gradient(-45deg, var(--panel-3) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--panel-3) 75%),
        linear-gradient(-45deg, transparent 75%, var(--panel-3) 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    border-radius: var(--radius-sm);
}

/* ---------- Studio libre : le formulaire suit le modèle ----------
   La fiche du modèle choisi, sous les menus Famille → Version : ce qu'il sait
   faire en deux phrases, ce qui distingue la version, et ses capacités en
   pastilles (photos, définitions, formats, fond transparent, prix). */
.model-info {
    margin: -4px 0 16px;
    padding: 10px 12px;
    background: var(--panel-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    line-height: 1.45;
}
.model-info { padding: 6px 10px; }
.mi-resume { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; width: 100%;
    padding: 2px 0; border: none; background: none; color: var(--text); font: inherit;
    text-align: left; cursor: pointer; }
.mi-resume:hover .mi-caret { color: var(--accent); }
.mi-caret { color: var(--muted); font-size: 11px; width: 10px; }
.mi-detail { padding: 6px 0 2px 18px; }
.model-info p { margin: 0 0 6px; }
.model-info .mi-note { color: var(--muted); }
.mi-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.mi-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--panel);
    font-size: 11.5px;
    white-space: nowrap;
}
/* Photos déposées pour un modèle qui n'en prend pas : gardées, mises de côté. */
.photo-aside {
    margin: -6px 0 16px;
    padding: 8px 10px;
    border: 1px solid var(--info-border);
    border-radius: var(--radius-sm);
    background: var(--info-bg);
    color: var(--info-text);
    font-size: 12px;
    line-height: 1.4;
}
/* Photo au-delà de ce que le modèle accepte : gardée, grisée, pas envoyée. */
.thumb.is-off img { opacity: .35; filter: grayscale(1); }

/* ---------- Lot de prompts (Preset client) ---------- */
.lot-bloc textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.lot-sections { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lot-sections li {
    display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: baseline;
    padding: 8px 11px; border-radius: var(--radius-sm);
    background: var(--panel-2); border: 1px solid var(--border-soft); font-size: 12.5px;
}
.lot-sections li.is-err { background: var(--err-bg); border-color: var(--err-border); }
.lot-sections li.is-ok  { background: var(--ok-bg); border-color: var(--ok-border); }
.lot-sections li.is-run { background: var(--info-bg); border-color: var(--info-border); }
.lot-slug { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; }
.lot-etat { color: var(--muted); }
.lot-sections li.is-err .lot-etat { color: var(--err-text); }
.lot-sections li.is-ok  .lot-etat { color: var(--ok-text); }
.lot-sections li.is-run .lot-etat { color: var(--info-text); }
.lot-notes { grid-column: 1 / -1; margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.lot-notes .is-err  { color: var(--err-text); }
.lot-notes .is-warn { color: var(--warn-text); }
.lot-actions { margin-top: 12px; }
.lot-actions .btn-primary { flex: 1; }
.lot-head { margin-top: 0; }
.lot-head a { text-transform: none; letter-spacing: 0; font-size: 12px; padding: 5px 10px; }
.lot-cards {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px;
    margin-bottom: 18px;
}
.lot-card {
    display: flex; flex-direction: column; gap: 7px; padding: 9px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2);
}
.lot-card.is-err { border-color: var(--err-border); background: var(--err-bg); }
.lot-card .lot-img {
    width: 100%; aspect-ratio: 16 / 9; object-fit: contain; display: block;
    background: var(--panel-3); border-radius: 6px; cursor: pointer;
}
.lot-card .lot-attente {
    width: 100%; aspect-ratio: 16 / 9; display: grid; place-items: center;
    background: var(--panel-3); border-radius: 6px; color: var(--muted); font-size: 12px;
}
.lot-card.is-run .lot-attente { animation: pulse 1.3s ease-in-out infinite; }
.lot-card .lot-slug { font-size: 12px; word-break: break-all; }
.lot-card .lot-etat { font-size: 11.5px; line-height: 1.4; }
.lot-card.is-err .lot-etat { color: var(--err-text); }
.lot-card .result-actions { margin-top: 0; gap: 6px; }
.lot-card .result-actions > * { font-size: 12px; padding: 6px 9px; }

/* ---------- Historique complet (historique.html), classé par mois ---------- */
.layout-one { grid-template-columns: 1fr; max-width: 1180px; }
.histo-filtres { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.histo-filtres select { max-width: 300px; }
.histo-mois { margin: 0 0 22px; }
.histo-mois-titre {
    display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
    margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border-soft);
    font-size: 15px; font-weight: 700; text-transform: capitalize;
}
.histo-mois-titre .muted { font-size: 12px; font-weight: 500; text-transform: none; }
.histo-grille {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}
.histo-vide { color: var(--muted); padding: 30px 0; text-align: center; }
