/* ── Reset & Base ────────────────────────────────────────── */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #F7FAFA;
    --bg-card: #ffffff;
    --text: #17343A;
    --text-muted: #60777B;
    --border: #D7DEE1;
    --border-light: #eef4f4;
    --border-strong: #087C86;
    --primary: #087C86;
    --primary-hover: #075E67;
    --success: #2F9E44;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0891b2;
    --ink: var(--text);
    --ink-soft: var(--text-muted);
    --mark: var(--danger);
    --paper: var(--bg);
    --stage-prep: #475569;
    --stage-prep-bg: #f1f5f9;
    --stage-prep-head: #e2e8f0;
    --stage-improve: #9c8758;
    --stage-improve-bg: #fbfaf6;
    --stage-improve-head: #f5f0e3;
    --stage-upload: #16a34a;
    --stage-upload-bg: #f0fdf4;
    --stage-upload-head: #dcfce7;
    --stage-download: #6d28d9;
    --stage-download-bg: #f5f3ff;
    --stage-download-head: #ede9fe;
    --diff-add: #d4edda;
    --diff-del: #f8d7da;
    --diff-mod: #fff3cd;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --navbar-height: 3.25rem;
    --dashboard-offset: 4rem;
    --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: var(--font-ui);
}

body {
    font-family: var(--font-ui);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ── Navbar ──────────────────────────────────────────────── */

.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    min-height: var(--navbar-height);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none;
}
.nav-brand:hover { color: var(--primary); }

.nav-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
    padding-bottom: 0.08rem;
}

.nav-primary {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.18rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.nav-item,
.nav-logout,
.nav-login {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    white-space: nowrap;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.nav-item {
    padding: 0.42rem 0.8rem;
    border-radius: 999px;
    color: var(--text-muted);
}
.nav-item:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.7);
}
.nav-item.is-active {
    background: var(--bg-card);
    color: var(--primary);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.nav-item:focus-visible,
.nav-logout:focus-visible,
.nav-login:focus-visible,
.nav-brand:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.nav-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.nav-account {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.nav-user {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.nav-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    flex-shrink: 0;
    border-radius: 50%;
    background: #e8eefc;
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0;
}

.nav-user-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 16rem;
}

.nav-logout {
    padding: 0.38rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    background: transparent;
}
.nav-logout:hover {
    color: var(--danger);
    border-color: #fecaca;
    background: #fef2f2;
}

.nav-login {
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}
.nav-login:hover { background: var(--primary-hover); color: #fff; }

@media (prefers-reduced-motion: reduce) {
    .nav-item, .nav-logout, .nav-login { transition: none; }
}

@media (max-width: 860px) {
    .nav-user-email { display: none; }
}

@media (max-width: 640px) {
    .navbar { padding: 0 0.75rem; gap: 0.6rem; }
    .nav-brand { font-size: 0.92rem; }
    .nav-item span,
    .nav-logout span { display: none; }
    .nav-item,
    .nav-logout { padding: 0.42rem 0.55rem; }
}

/* ── Container ───────────────────────────────────────────── */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

/* ── Cards ────────────────────────────────────────────────── */

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

/* ── Buttons ──────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.52rem 1.05rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 2px rgba(47, 143, 173, 0.28);
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(47, 143, 173, 0.22);
}

.btn-secondary { background: var(--bg-card); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg); }

.btn-success {
    background: var(--success, #22c55e); color: #fff; border-color: var(--success, #22c55e);
    flex-shrink: 0; align-self: center; white-space: nowrap;
}
.btn-success:hover:not(:disabled) { background: #16a34a; border-color: #16a34a; }

.btn-primary-outline {
    background: transparent; color: var(--primary); border: 1.5px solid var(--primary);
    font-weight: 600; flex-shrink: 0; white-space: nowrap;
}
.btn-primary-outline:hover:not(:disabled) { background: var(--primary); color: #fff; }
.btn-primary-outline:disabled { opacity: 0.5; cursor: wait; }

.export-sep {
    color: var(--border); font-size: 0.9rem; user-select: none; padding: 0 0.1rem;
}

.btn-comment {
    background: none;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    margin-top: 0.5rem;
}
.btn-comment:hover { border-color: var(--primary); color: var(--primary); }

.btn-comment-sm {
    background: none;
    border: 1px dashed var(--border);
    border-radius: 6px;
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    cursor: pointer;
}
.btn-comment-sm:hover { border-color: var(--primary); color: var(--primary); }

.btn-valider {
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.3rem 0.8rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.btn-valider:hover:not(:disabled) { background: #15803d; transform: scale(1.02); }
.btn-valider:disabled { background: #86efac; cursor: default; }

.btn-relancer {
    background: var(--warning);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.3rem 0.8rem;
    font-size: 0.7rem;
    cursor: pointer;
}
.btn-relancer:hover { background: #b45309; }

.btn-next-para {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 600;
    transition: border-color 0.15s, color 0.15s;
}
.btn-next-para:hover { border-color: var(--primary); color: var(--primary); }

.btn-jump-valider {
    background: #fff;
    border: 1px solid var(--success);
    border-radius: 6px;
    padding: 0.3rem 0.65rem;
    font-size: 0.7rem;
    color: var(--success);
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.btn-jump-valider:hover {
    background: var(--success);
    color: #fff;
}

.btn-lancer-para {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.3rem 0.8rem;
    font-size: 0.7rem;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.btn-lancer-para:hover:not(:disabled) { background: #4338ca; transform: scale(1.02); }
.btn-lancer-para:disabled { opacity: 0.6; cursor: default; }

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.78rem; }

/* ── Forms ────────────────────────────────────────────────── */

.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.3rem;
    color: var(--text);
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.form-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}
.error-msg {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--diff-del);
    color: var(--danger);
    border-radius: var(--radius);
    font-size: 0.85rem;
}

/* ── Badges ───────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-nouveau { background: #334155; color: #fff; }
.badge-en_cours { background: #1e40af; color: #fff; }
.badge-termine { background: var(--success); color: #fff; }
.badge-erreur { background: var(--danger); color: #fff; }
.badge-interrompu { background: var(--warning); color: #fff; }
.badge-escalade { background: #b45309; color: #fff; }
.badge-en_attente { background: #64748b; color: #fff; }

/* ── Page Header ──────────────────────────────────────────── */

.page-header { margin-bottom: 1.5rem; }
.page-header h1 {
    font-family: var(--font-display);
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ── Project List ─────────────────────────────────────────── */

.new-project-form { margin-bottom: 2rem; max-width: 600px; }
.new-project-form h2 { font-size: 1.1rem; margin-bottom: 1rem; }

.label-hint { font-size: .8rem; color: var(--muted, #64748b); font-weight: 400; }
.field-hint { font-size: .82rem; color: var(--muted, #64748b); margin-top: .4rem; line-height: 1.5; }

/* Bouton GDoc dans la toolbar */
.btn-gdoc { background: #34a853; color: #fff; border: none; }
.btn-gdoc:hover { background: #2d9248; }

/* Toggle mode automatique GDoc */
.gdoc-auto-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text);
    vertical-align: middle;
    user-select: none;
    white-space: nowrap;
}
.gdoc-auto-toggle input[type="checkbox"] {
    accent-color: #34a853;
    cursor: pointer;
    width: 1.05rem;
    height: 1.05rem;
}
.gdoc-auto-label { font-weight: 500; }
.gdoc-auto-badge {
    display: inline-block;
    background: var(--success);
    color: #fff;
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.7rem;
    font-weight: 600;
    vertical-align: middle;
    margin-left: 0.3rem;
}

.project-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.project-card {
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s, transform 0.15s;
}
.project-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.project-card h3 {
    font-family: var(--font-display);
    font-size: 1.18rem;
    margin-bottom: 0.5rem;
}
.project-meta { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.progress-text { font-size: 0.85rem; font-weight: 600; color: var(--primary); }

/* ── Progress Bar ─────────────────────────────────────────── */

.progress-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}
.progress-bar-lg { height: 10px; border-radius: 5px; }
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #60a5fa);
    border-radius: inherit;
    transition: width 0.5s ease;
}

.progress-section { margin-bottom: 1.5rem; }
.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}
.progress-detail { color: var(--text-muted); }

.pipeline-board {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    margin: 0.45rem 0 0.2rem;
    align-items: stretch;
    background: #e2e8f0;
    border-radius: 12px;
    padding: 0.5rem;
}
.pipeline-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}
.pipeline-group--prep {
    flex: 1.4 1 0;
    background: #EFFAFA;
    border: 1.5px solid #A9DEDE;
}
.pipeline-group--improve {
    flex: 5 1 0;
    background: #fffbeb;
    border: 1.5px solid #fcd34d;
}
.pipeline-group--upload {
    flex: 1.8 1 0;
    background: #f0fdf4;
    border: 1.5px solid #86efac;
}
.pipeline-group--download {
    flex: 2 1 0;
    background: #f5f3ff;
    border: 1.5px solid #c4b5fd;
}
.pipeline-group-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 0.5rem;
    min-height: 2.3rem;
}
.pipeline-group--prep .pipeline-group-head    { background: #D6F1F0; border-bottom: 1.5px solid #A9DEDE; }
.pipeline-group--improve .pipeline-group-head { background: #fde68a; border-bottom: 1.5px solid #fcd34d; }
.pipeline-group--upload .pipeline-group-head  { background: #bbf7d0; border-bottom: 1.5px solid #86efac; }
.pipeline-group--download .pipeline-group-head{ background: #ddd6fe; border-bottom: 1.5px solid #c4b5fd; }
.pipeline-group-label {
    margin: 0;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.3;
}
.pipeline-group--prep .pipeline-group-label    { color: #075E67; }
.pipeline-group--improve .pipeline-group-label { color: #78350f; }
.pipeline-group--upload .pipeline-group-label  { color: #14532d; }
.pipeline-group--download .pipeline-group-label{ color: #4c1d95; }
.pipeline-group-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    flex-shrink: 0;
    padding: 0.28rem 0.4rem;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    background: rgba(255,255,255,0.4);
}
.force-reprocess-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    font-size: 0.68rem;
    color: var(--text-muted);
    user-select: none;
    white-space: nowrap;
}
.force-reprocess-toggle input {
    accent-color: var(--primary);
    cursor: pointer;
    width: 0.9rem;
    height: 0.9rem;
}
.pipeline-group-actions .btn {
    font-size: 0.65rem;
    padding: 0.14rem 0.45rem;
    white-space: nowrap;
}
.pipeline-group:has(.step.active) .pipeline-group-head {
    filter: brightness(0.95);
}
.pipeline-steps {
    display: flex;
    flex: 1;
    width: 100%;
    margin: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: hidden;
}
.pipeline-steps--improve {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: auto auto;
    overflow: visible;
    align-items: stretch;
}
.pipeline-steps--improve .pipeline-group-actions {
    grid-column: 1 / 3;
    grid-row: 2;
    border-bottom: none;
    border-top: 1px solid rgba(253,196,60,0.4);
    margin: 0;
    min-height: 2.1rem;
    background: rgba(253, 230, 138, 0.22);
}
/* All 4 step cells stretch to the same height */
.pipeline-steps--improve .step {
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.pipeline-steps--improve .step-inline-btn--card {
    margin-top: 0;
    flex: 1;
}
/* Uniform tinted background across the 4 improvement columns */
.pipeline-steps--improve .step {
    background: rgba(253, 230, 138, 0.22);
}
/* Columns sitting above the action bar keep their vertical rules */
.pipeline-steps--improve .step[data-step="correction"],
.pipeline-steps--improve .step[data-step="style"] {
    border-right: 1px solid rgba(253,196,60,0.3);
    border-left: 1px solid rgba(253,196,60,0.3);
}
/* State is carried by the inset top rule only — the surface stays uniform */
.pipeline-steps--improve .step.active,
.pipeline-steps--improve .step.done,
.pipeline-steps--improve .step.error {
    background: rgba(253, 230, 138, 0.22);
}
/* Hide redundant step-name/icon header above card buttons */
.pipeline-steps--improve .step-icon,
.pipeline-steps--improve .step-name { display: none; }
.pipeline-steps--improve .step:nth-child(4) { border-right: none; }
.step {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.18rem;
    padding: 0.4rem 0.25rem 0.35rem;
    border-right: 1px solid #e5e7eb;
    min-width: 0;
    background: transparent;
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    transition: background 0.2s, box-shadow 0.2s, color 0.2s;
    user-select: none;
}
.step:last-child { border-right: none; }
.step-icon,
.step-icon-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    flex-shrink: 0;
    color: var(--stage-improve);
    background: rgba(255, 255, 255, 0.72);
    border-radius: 6px;
}
.step-icon svg,
.step-icon-toggle svg {
    width: 1.15rem;
    height: 1.15rem;
    display: block;
}
.step-icon-toggle {
    position: relative;
    cursor: pointer;
    margin: 0;
    border: 1px solid transparent;
}
.step-icon-toggle:hover {
    background: #fff;
    border-color: var(--border);
    color: var(--ink);
}
.step-icon-toggle:focus-within {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.step-pref {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.step-icon-toggle:has(.step-pref:not(:checked)) {
    opacity: 0.42;
    color: var(--text-muted);
}
.step--off .step-icon,
.step--off .step-icon-toggle {
    color: var(--text-muted);
}
.step-name {
    display: block;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.step-model-select {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 0.12rem 0.15rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    color: var(--text);
    font-size: 0.58rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
}
.step-model-select:disabled { opacity: 0.55; cursor: default; }
.step-inline-btn {
    margin-top: auto;
    width: calc(100% - 0.2rem);
    min-height: 2.65rem;
    height: 2.65rem;
    padding: 0.2rem 0.5rem;
    border: 1.5px solid #A9DEDE;
    border-radius: 8px;
    background: #EFFAFA;
    color: #087C86;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    text-align: center;
    box-sizing: border-box;
    transition: background 0.12s, border-color 0.12s;
}
.step-inline-btn svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}
.step-inline-btn:hover:not(:disabled) {
    background: #DDF4F3;
    border-color: #087C86;
    color: #075E67;
}
.step-inline-btn:disabled { opacity: 0.55; cursor: default; }
/* Tall card variant: icon centred on line 1, label below */
.step-inline-btn--card {
    flex-direction: column;
    height: auto;
    min-height: unset;
    white-space: normal;
    gap: 0.35rem;
    padding: 0.5rem 0.4rem 0.45rem;
    font-size: 0.72rem;
}
.step-inline-btn--card svg {
    width: 1.4rem;
    height: 1.4rem;
}
.step--off .step-inline-btn { opacity: 0.38; }
.step-prompt-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.2rem;
    width: calc(100% - 0.2rem);
    margin-top: 0.12rem;
}
.step-prompt-btn {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.12rem 0.28rem;
    border: 1px dashed var(--border);
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.58rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
}
.step-prompt-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #fff;
}
.step-prompt-btn--readonly {
    border-style: dotted;
    opacity: 0.85;
}
.step-prompt-btn--readonly:hover {
    opacity: 1;
}
.step-prompt-btn::after {
    content: "";
    display: none;
    width: 0.42rem;
    height: 0.42rem;
    margin-left: 0.25rem;
    border-radius: 50%;
    vertical-align: middle;
}
.step-prompt-btn[data-prompt-status="active"]::after,
.step-prompt-btn[data-prompt-status="pending"]::after,
.step-prompt-btn[data-prompt-status="rejected"]::after {
    display: inline-block;
}
.step-prompt-btn[data-prompt-status="active"]::after { background: #15803d; }
.step-prompt-btn[data-prompt-status="pending"]::after { background: #d97706; }
.step-prompt-btn[data-prompt-status="rejected"]::after { background: var(--danger); }
.step-reload-btn {
    margin-top: 0.45rem;
    width: calc(100% - 0.3rem);
    font-weight: 700;
    padding: 0.6rem 0.5rem;
    font-size: 0.72rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}
.step-reload-btn svg {
    width: 1.5rem;
    height: 1.5rem;
}
.step-gdoc-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.22rem;
    margin-top: auto;
    width: 100%;
    padding: 0.1rem 0.15rem 0;
}
.step-gdoc-actions .btn {
    font-size: 0.62rem;
    padding: 0.22rem 0.35rem;
    white-space: nowrap;
}
.step-gdoc-actions .export-status {
    font-size: 0.62rem;
    font-weight: 600;
    white-space: normal;
    text-align: center;
    line-height: 1.3;
    min-height: 0.8rem;
}
.step-gdoc-actions .export-status:empty {
    display: none;
}
.pipeline-group--upload .pipeline-steps,
.pipeline-group--upload .step[data-step="export_gdoc"] {
    overflow: hidden;
}
.pipeline-group--upload .step-export-btn--card {
    border-color: #86efac;
    background: #f0fdf4;
    color: #166534;
}
.pipeline-group--upload .step-export-btn--card:hover {
    background: #dcfce7;
    border-color: #16a34a;
    color: #14532d;
}
.pipeline-group--download .step-export-btn--card {
    border-color: #c4b5fd;
    background: #f5f3ff;
    color: #5b21b6;
}
.pipeline-group--download .step-export-btn--card:hover {
    background: #ede9fe;
    border-color: #7c3aed;
    color: #4c1d95;
}
.step-meta {
    display: block;
    font-size: 0.62rem;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.25;
    max-width: 100%;
}
.step.active {
    background: #dbeafe;
    box-shadow: inset 0 3px 0 var(--primary);
}
.step.done {
    background: #d1fae5;
    box-shadow: inset 0 3px 0 var(--success);
}
.step.error {
    background: #fef2f2;
    box-shadow: inset 0 2px 0 var(--danger);
}
.step-export-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.2rem;
    height: 1.2rem;
    padding: 0 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
}
.step-export-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.step-export-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}
/* Card variant used in Download section */
.step-export-btn--card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    width: 100%;
    height: auto;
    min-height: unset;
    padding: 0.45rem 0.3rem;
    border-radius: 8px;
    border: 1.5px solid #A9DEDE;
    background: #EFFAFA;
    color: #087C86;
    font-size: 0.72rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    white-space: normal;
    text-align: center;
    transition: background 0.12s, border-color 0.12s;
    box-sizing: border-box;
}
.step-export-btn--card .export-arrow {
    font-size: 1.1rem;
    line-height: 1;
}
.step-export-btn--card:hover {
    background: #DDF4F3;
    border-color: #087C86;
    color: #075E67;
}
.step-export-btn--card:disabled { opacity: 0.6; cursor: wait; }
.step-export-meta {
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    min-height: 0.8rem;
}
.step-export-meta:empty { display: none; }

/* ── Sticky Dashboard ────────────────────────────────────── */

.dashboard {
    position: sticky;
    top: var(--navbar-height);
    z-index: 90;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    margin: -1.5rem -2rem 1rem -2rem;
    padding: 0.55rem 2rem 0.65rem;
    box-shadow: 0 6px 18px rgba(28, 36, 48, 0.06);
}

.dashboard-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 2.4rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.dashboard-burger {
    flex-shrink: 0;
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dashboard-burger-chevron {
    display: block;
    width: 0.55rem;
    height: 0.55rem;
    border-right: 2px solid var(--text);
    border-bottom: 2px solid var(--text);
    /* panneau ouvert : pointe vers le haut (▲ = réduire) */
    transform: rotate(-135deg) translate(1px, 2px);
    transition: transform 0.2s;
}
/* panneau replié : pointe vers le bas (▼ = agrandir) */
.dashboard--collapsed .dashboard-burger-chevron {
    transform: rotate(45deg) translate(1px, -1px);
}
.dashboard-burger:hover { border-color: var(--primary); }
.dashboard-burger:hover .dashboard-burger-chevron {
    border-color: var(--primary);
}

.prefs-wrap {
    position: relative;
    flex-shrink: 0;
}
.dashboard-prefs-btn {
    width: 2.1rem;
    height: 2.1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    cursor: pointer;
    font-size: 1.05rem;
    line-height: 1;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
.dashboard-prefs-btn:hover,
.dashboard-prefs-btn[aria-expanded="true"] {
    border-color: var(--primary);
    color: var(--primary);
}
.prefs-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 120;
    min-width: 220px;
    padding: 0.7rem 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}
.prefs-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.45rem;
}
.prefs-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    padding: 0.2rem 0;
    cursor: pointer;
    user-select: none;
}
.prefs-item input { accent-color: var(--primary); cursor: pointer; }
.prefs-hint {
    margin: 0.45rem 0 0;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.35;
}
.prefs-hint a { color: var(--primary); }
.prefs-item--select {
    justify-content: space-between;
    gap: 0.75rem;
}
.prefs-item--select select {
    padding: 0.15rem 0.3rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    font-size: 0.8rem;
}
.step--off {
    background: #f8fafc;
}
.step--off .step-name {
    color: var(--text-muted);
    font-weight: 500;
}
.step--locked {
    cursor: default;
}
.step--locked .toggle-switch input:checked + .toggle-slider {
    background: #22c55e;
    cursor: default;
    opacity: 0.9;
}
.step--locked .toggle-switch input:disabled + .toggle-slider {
    cursor: default;
}

.dashboard-bar .project-title-row {
    margin: 0;
    min-width: 0;
    flex: 0 1 auto;
    gap: 0.45rem;
}
.project-title-kicker {
    font-family: var(--font-ui);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    flex-shrink: 0;
}
.dashboard-bar .project-title-row h1 {
    font-family: var(--font-display);
    font-size: 1.22rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 28vw;
    cursor: pointer;
}
.projet-nom-input {
    font-family: var(--font-display);
    font-size: 1.22rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--primary);
    border-radius: 6px;
    padding: 0.1rem 0.4rem;
    min-width: 12rem;
    max-width: 28vw;
    line-height: 1.3;
}
.projet-nom-input:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}
.btn-rename-projet {
    flex-shrink: 0;
    width: 1.7rem;
    height: 1.7rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-rename-projet svg {
    width: 0.95rem;
    height: 0.95rem;
}
.btn-rename-projet:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--bg-card);
}

.dashboard-status {
    flex: 1;
    min-width: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-status[hidden] { display: none; }

.llm-error-banner {
    display: block;
    margin: 0.35rem 0 0.15rem;
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius);
    background: #fee2e2;
    color: #b91c1c;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.35;
    white-space: normal;
}
.llm-error-banner[hidden] { display: none; }

.dashboard-body {
    padding-top: 0.5rem;
    overflow-y: auto;
    max-height: calc(100vh - var(--navbar-height) - 8.5rem);
}
.dashboard--collapsed .dashboard-body {
    display: none;
}
.projet-tab-panel .pipeline-board {
    margin: 0;
}
#tabPanelEtapes .dashboard-bottom {
    margin-top: 0.75rem;
}

.dashboard-bottom {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}
.dashboard-active {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex: 5 1 26rem;
    min-width: 22rem;
    margin: 0;
}
.dashboard-analyse {
    flex: 3 1 14rem;
    min-width: 12rem;
    max-width: 40%;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.dashboard-progress {
    flex: 0 0 180px;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.dashboard-bar .dashboard-progress {
    flex: 1;
    min-width: 140px;
}
.dashboard-progress .progress-bar { margin-bottom: 0; }
.dashboard-progress .progress-info {
    margin-bottom: 0;
    font-size: 0.82rem;
}

.usage-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.55rem;
    flex-shrink: 0;
    text-decoration: none;
    color: inherit;
    font-size: 0.78rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.35rem 0.7rem;
    font-variant-numeric: tabular-nums;
    box-shadow: var(--shadow);
}
.usage-summary:hover {
    border-color: var(--primary);
    background: #fff;
    box-shadow: var(--shadow-lg);
}
.usage-item {
    color: var(--text-muted);
    white-space: nowrap;
}
.usage-item:not(:last-child) {
    border-right: 1px solid var(--border);
    padding-right: 0.5rem;
}
.usage-item b {
    color: var(--text);
    font-weight: 700;
    margin-left: 0.15rem;
}
.usage-item--total {
    color: var(--ink);
    font-weight: 700;
}
.usage-item--total b { color: var(--ink); }

.dashboard-panel-caption {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    line-height: 1.2;
    min-height: 1.05rem;
}

.active-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    background: var(--bg-card, #fff);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    table-layout: auto;
}
.active-table thead th {
    background: #e8edf3;
    color: var(--ink);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.04em;
    padding: 0.4rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.active-table tbody td {
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.active-table-row:last-child td { border-bottom: none; }
.active-table-empty td {
    text-align: center;
    color: var(--text-muted, #94a3b8);
    padding: 0.6rem;
    font-style: italic;
}

.active-para-link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}
.active-para-link:hover { text-decoration: underline; }

.para-type-badge--sm {
    font-size: 0.65rem;
    padding: 0.1rem 0.35rem;
}

.active-texte-cell {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #475569;
}

.active-step-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    background: #e0e7ff;
    color: #3730a3;
}
.active-step-correction  { background: #fef3c7; color: #92400e; }
.active-step-style       { background: #ede9fe; color: #5b21b6; }
.active-step-relecture   { background: #dbeafe; color: #1e40af; }
.active-step-mise_en_page { background: #d1fae5; color: #065f46; }
.active-step-transition  { background: #fce7f3; color: #9d174d; }
.active-step-factcheck   { background: #ffedd5; color: #c2410c; }
.active-step-relecture_fond { background: #e0e7ff; color: #3730a3; }

.agent-track {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.2rem;
}
.agent-track-sep {
    color: #cbd5e1;
    font-size: 0.65rem;
    padding: 0 0.05rem;
}
.agent-chip {
    display: inline-block;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
    background: #f1f5f9;
    color: #94a3b8;
}
.agent-chip--idle { background: #cbd5e1; color: #334155; }
.agent-chip--active {
    background: var(--primary);
    color: #fff;
    animation: agent-chip-pulse 1.2s ease-in-out infinite;
}
.agent-chip--done { background: var(--success); color: #fff; }
.agent-chip--error { background: var(--danger); color: #fff; }
@keyframes agent-chip-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

.active-detail-cell {
    font-size: 0.72rem;
    color: #64748b;
    white-space: nowrap;
}

/* ── Heatmap ──────────────────────────────────────────────── */

.heatmap-container {
    flex: 1;
    min-width: 0;
    background: var(--bg-card);
    border: 1px solid #e5e7eb;
    border-radius: var(--radius);
    padding: 0.4rem 0.6rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.heatmap-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 0.45rem;
    gap: 0.35rem;
}

.heatmap-view-toggle {
    display: inline-flex;
    gap: 0.15rem;
    background: #e2e8f0;
    padding: 0.18rem;
    border-radius: 999px;
    flex-shrink: 0;
}
.heatmap-view-tab {
    appearance: none;
    border: none;
    background: transparent;
    color: #64748b;
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.22rem 0.7rem;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
}
.heatmap-view-tab:hover {
    color: #0f172a;
}
.heatmap-view-tab--active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1);
}

.heatmap-legend {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.heatmap-legend-item {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.58rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.heatmap-dot {
    width: 7px;
    height: 7px;
    border-radius: 2px;
    flex-shrink: 0;
}

.heatmap-grid {
    display: flex;
    flex-direction: column;
    gap: 1px;
    max-height: 100px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.heatmap-grid[hidden] { display: none; }
.heatmap-grid::-webkit-scrollbar { width: 4px; }
.heatmap-grid::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

.heatmap-grid--chapitres {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.7rem;
    max-height: min(320px, 42vh);
}

.heatmap-chapter {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.28rem;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.heatmap-chapter-cells {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0.4rem;
    width: 100%;
    box-sizing: border-box;
}

.heatmap-chapter-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #334155;
    text-decoration: none;
    text-align: left;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.25;
    padding: 0;
}
.heatmap-chapter-title:hover {
    color: var(--primary);
    text-decoration: underline;
}

.heatmap-row {
    display: flex;
    align-items: center;
    gap: 2px;
}

.heatmap-row-label {
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 2.2rem;
    text-align: right;
    padding-right: 0.25rem;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    user-select: none;
}

.heatmap-cell {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    text-decoration: none;
    position: relative;
    flex-shrink: 0;
}
.heatmap-cell:hover {
    transform: scale(1.8);
    box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 3px var(--text-muted);
    z-index: 2;
}

.heatmap-cell--en_attente,
.heatmap-dot--en_attente { background: #C2D4C8; }
.heatmap-cell--en_cours { background: #1B8A96; animation: heatmap-pulse 1.5s ease-in-out infinite; }
.heatmap-dot--en_cours { background: #1B8A96; }
.heatmap-cell--termine,
.heatmap-dot--termine { background: #7ED9A0; }
.heatmap-cell--valide,
.heatmap-dot--valide { background: #2FA866; }
.heatmap-cell--gdoc_updated,
.heatmap-dot--gdoc_updated { background: #0C9B74; }
.heatmap-cell--escalade,
.heatmap-dot--escalade { background: #E39B3C; }
.heatmap-cell--erreur,
.heatmap-dot--erreur { background: #D05652; }

@keyframes heatmap-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ── Jump Nav ─────────────────────────────────────────────── */

.jump-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    overflow-x: auto;
    flex: 1;
    min-width: 0;
    scrollbar-width: none;
    padding: 0.15rem 0;
}
.jump-nav::-webkit-scrollbar { display: none; }

.jump-nav-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.jump-link {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.jump-link:hover {
    background: var(--stage-improve);
    color: #fff;
}
.jump-link--last {
    background: #f1f5f9;
    color: var(--text-muted);
    border: 1px dashed var(--border);
}
.jump-link--last:hover {
    background: var(--primary);
    color: #fff;
    border-color: transparent;
}

/* Scroll offset for anchored paragraphs */
.para-row[id^="para-"] {
    scroll-margin-top: calc(var(--navbar-height) + var(--dashboard-offset) + 8px);
}

/* ── Project Detail ───────────────────────────────────────── */

.project-header { margin-bottom: 0.4rem; }
.project-title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.25rem;
}
.project-title-row h1 { font-size: 1.3rem; }
.toolbar { display: flex; align-items: flex-start; gap: 0.75rem; flex-wrap: wrap; }
.toolbar-divider {
    width: 1px;
    height: 1.4rem;
    background: var(--border);
    flex-shrink: 0;
}
.settings-cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.45rem 0.9rem;
    padding: 0.55rem 0.85rem 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-width: 42rem;
    box-shadow: var(--shadow);
}
.settings-cluster--tab {
    max-width: none;
    box-shadow: none;
    border: 1px solid #e2e8f0;
    padding: 0.65rem 0.9rem;
    background: #f8fafc;
    border-radius: 10px;
    margin-bottom: 0.75rem;
}
.settings-improve {
    margin-top: 0;
    background: #fffbeb;
    border: 1.5px solid #fcd34d;
    border-radius: 10px;
    overflow: hidden;
}
.settings-improve-head {
    background: #fde68a;
    border-bottom: 1.5px solid #fcd34d;
    color: #78350f;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-align: center;
    padding: 0.45rem 0.4rem;
    line-height: 1.3;
}
.settings-agents {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.settings-step {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    min-width: 0;
    padding: 0.5rem 0.45rem 0.6rem;
    border-right: 1px solid #fcd34d;
    text-align: center;
}
.settings-step:last-child { border-right: none; }
.settings-step-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    min-height: 1.7rem;
}
.settings-step-head .step-name {
    font-size: 0.75rem;
    font-weight: 600;
}
.settings-step-llms {
    display: flex;
    gap: 0.3rem;
    min-width: 0;
}
.settings-step-llms .step-model-select {
    flex: 1 1 0;
    width: 100%;
    min-width: 0;
    max-width: none;
    font-size: 0.72rem;
    padding: 0.28rem 0.35rem;
}
.settings-step .step-prompt-row {
    width: 100%;
    margin: 0;
    justify-content: stretch;
    gap: 0.3rem;
}
.settings-step .step-prompt-btn {
    flex: 1 1 0;
    font-size: 0.72rem;
    padding: 0.28rem 0.4rem;
    background: rgba(255, 255, 255, 0.7);
}
.settings-cluster-title {
    width: 100%;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink);
    line-height: 1.2;
}
.settings-block {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 12rem;
    flex: 1 1 14rem;
}
.settings-hint {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.35;
    max-width: 22rem;
}
.settings-workers {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
}
.settings-workers-label {
    color: var(--text);
}
.launch-cluster,
.export-cluster {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    padding: 0.35rem 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.export-cluster {
    background: #f8fafc;
    border-left: 3px solid #34a853;
}
.toolbar-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-left: auto;
}
.toolbar-label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.parallel-launch {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.3rem 0.6rem;
}

.parallel-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.parallel-input {
    width: 3.2rem;
    padding: 0.25rem 0.35rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.82rem;
    text-align: center;
    font-weight: 600;
    font-family: inherit;
}
.parallel-input--wide {
    width: 4.2rem;
}
.parallel-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 110, 168, 0.15);
}

.parallel-sep {
    color: var(--border);
    font-size: 0.9rem;
    margin: 0 0.1rem;
    user-select: none;
}

.parallel-input::placeholder {
    color: #cbd5e1;
    font-weight: 400;
}

.parallel-status {
    font-size: 0.72rem;
    white-space: nowrap;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-accent {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.3rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.btn-accent:hover:not(:disabled) { background: linear-gradient(135deg, #6d28d9, #5b21b6); transform: scale(1.02); }
.btn-accent:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-danger-sm {
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-danger-sm:hover { background: #b91c1c; }

.export-group { display: flex; gap: 0.5rem; margin-left: auto; align-items: center; }
.export-status {
    font-size: 0.72rem;
    color: var(--text-muted);
    max-width: 200px;
    white-space: nowrap;
}

/* ── Paragraph Table (unified) ───────────────────────────── */

.para-table {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.para-row {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
    scroll-margin-top: calc(var(--navbar-height) + var(--dashboard-offset) + 8px);
}
.para-row:hover { box-shadow: var(--shadow-lg); }

.para-row--validated {
    border-left: 4px solid var(--success);
    background: #fafff9;
}

.para-row--escalade {
    border-left: 4px solid var(--warn, #d97706);
    background: #fffbf0;
}
.para-row--escalade .para-row-header {
    background: #fff8ec;
}

.para-row--erreur {
    border-left: 4px solid var(--danger, #ef4444);
    background: #fff7f7;
}
.para-row--erreur .para-row-header {
    background: #fef2f2;
}

.para-row--processing {
    border-left: 4px solid var(--primary);
}

.para-row-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.para-numero {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 2rem;
}

.para-tokens {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--info);
    background: #ecfeff;
    border: 1px solid #a5f3fc;
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    letter-spacing: 0;
    white-space: nowrap;
}

.para-type-badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--info);
    background: #ecfeff;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}
.para-type-badge--chapitre {
    background: #fef3c7;
    color: #92400e;
}
.para-type-badge--partie {
    background: #fce7f3;
    color: #9d174d;
}
.para-type-badge--titre,
.para-type-badge--sous_titre {
    background: #e0f2fe;
    color: #075985;
}

.status-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    background: #f1f5f9;
    color: #64748b;
}
.status-valide {
    background: #dcfce7 !important;
    color: #16a34a !important;
}
.status-erreur {
    background: #fee2e2 !important;
    color: #dc2626 !important;
}

.para-row-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.para-row-body {
    display: flex;
    flex-direction: column;
}

/* ── Row 1: Avant / Diff / Final (3 columns) ────────────── */

.para-top-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1.2fr;
    min-height: 0;
    border-bottom: 1px solid var(--border-light);
}

/* ── Row 2: Agents table (full width) ───────────────────── */

.para-bottom-row {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 0;
}

/* ── Cells ────────────────────────────────────────────────── */

.para-cell {
    padding: 0.75rem 1rem;
}

.para-cell--avant {
    border-right: 1px solid var(--border-light);
    background: #fcfcfd;
}

.para-cell--diff {
    border-right: 1px solid var(--border-light);
    background: var(--bg-card);
}

.para-cell--final {
    background: #f0fdf4;
}

.para-cell--agents {
    background: #fcfcfd;
}

/* Scroll interne de la table agents quand il y a beaucoup de boucles */
.agents-table-wrap {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: 6px;
}
.agents-table-wrap .agents-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f1f5f9;
}

/* Statut GDoc / LaTeX inline sous les boutons */
.para-gdoc-status {
    margin-top: 0.5rem;
    font-size: 0.78rem;
    min-height: 1.2em;
}

.para-cell--transition {
    grid-column: 1 / -1;
    background: #f0f7ff;
    border-top: 2px solid var(--primary);
    padding: 0.8rem 1rem;
    border-radius: 0 0 8px 8px;
}
.transition-content {
    margin-top: 0.4rem;
}
.transition-text {
    font-style: italic;
    line-height: 1.6;
    color: var(--text);
    padding: 0.5rem 0.8rem;
    background: #fff;
    border-left: 3px solid var(--primary);
    border-radius: 4px;
}
.transition-justification {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    font-style: italic;
}

.btn-transition-gdoc {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.5rem;
    padding: 0.3rem 0.7rem;
    background: linear-gradient(135deg, #4285f4, #1a73e8);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.btn-transition-gdoc:hover:not(:disabled) {
    background: linear-gradient(135deg, #1a73e8, #1557b0);
    transform: scale(1.02);
}
.btn-transition-gdoc:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.transition-inserted-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--success);
    background: #dcfce7;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.para-cell-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.para-text {
    font-size: 0.88rem;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}

.para-text--editable {
    border: 1px dashed #86efac;
    border-radius: 6px;
    padding: 0.5rem 0.6rem;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}
.para-text--editable:hover { border-color: #4ade80; }
.para-text--editable:focus {
    border-style: solid;
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.para-final-hint {
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: #16a34a;
}

.para-final-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn-upload-gdoc {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    border: 1px solid #16a34a;
    color: #16a34a;
    background: #fff;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-upload-gdoc:hover:not(:disabled) { background: #16a34a; color: #fff; }
.btn-upload-gdoc:disabled { opacity: 0.6; cursor: default; }
.btn-upload-gdoc--pending {
    border-color: #86efac;
    color: #86efac;
    opacity: 0.85;
}
.btn-upload-gdoc--done {
    border-color: #16a34a;
    color: #fff;
    background: #16a34a;
}
.btn-upload-gdoc--done:hover:not(:disabled) {
    background: #15803d;
    border-color: #15803d;
}
.btn-upload-gdoc--error {
    border-color: #dc2626;
    color: #dc2626;
    background: #fff;
}

.btn-reset-original {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--text-muted, #94a3b8);
    color: var(--text-muted, #64748b);
    background: #fff;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-reset-original:hover:not(:disabled) { background: #f1f5f9; border-color: #64748b; color: #334155; }

.btn-version-ia {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    border: 1px solid #7c3aed;
    color: #7c3aed;
    background: #fff;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.btn-version-ia:hover:not(:disabled) { background: #7c3aed; color: #fff; }

.para-cell--diff.para-diff--ignored .para-diff {
    opacity: 0.55;
    filter: grayscale(0.7);
    border: 1px dashed #b45309;
    border-radius: 6px;
    padding: 0.5rem 0.6rem;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 8px,
        rgba(180, 83, 9, 0.05) 8px,
        rgba(180, 83, 9, 0.05) 16px
    );
}
.para-cell--diff.para-diff--ignored .para-cell-label::after {
    content: " — non prises en compte";
    color: #b45309;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}

.upload-status {
    font-size: 0.72rem;
    font-style: italic;
}

.gdoc-exported {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #16a34a;
    cursor: help;
    border-bottom: 1px dotted #16a34a;
}
.gdoc-exported--warn {
    color: var(--warn, #d97706);
    border-bottom-color: var(--warn, #d97706);
    cursor: help;
}
.gdoc-export-ts {
    font-weight: 500;
    color: var(--text, #334155);
}
.gdoc-export-src {
    font-weight: 500;
    color: var(--text-muted, #64748b);
}

.gdoc-upload-popup {
    position: absolute;
    z-index: 1000;
    max-width: 420px;
    max-height: 320px;
    overflow: auto;
    background: #fff;
    border: 1px solid var(--border, #cbd5e1);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    padding: 0.6rem 0.75rem;
    font-size: 0.78rem;
    line-height: 1.5;
}
.gdoc-upload-popup-head {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding-bottom: 0.4rem;
    margin-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-light, #e2e8f0);
    color: var(--text-muted, #64748b);
    font-size: 0.72rem;
}
.gdoc-upload-popup-body {
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text, #1e293b);
}
.gdoc-upload-popup-loading {
    color: var(--text-muted, #64748b);
    font-style: italic;
}

.placeholder {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85rem;
}

.placeholder--active {
    color: var(--primary);
    font-style: italic;
    font-size: 0.85rem;
}

.agent-cell--empty {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.78rem;
    padding: 0.75rem 0.6rem;
}

/* ── Diff column ─────────────────────────────────────────── */

.para-diff {
    font-size: 0.84rem;
    line-height: 1.6;
    word-break: break-word;
}
.para-diff ins {
    background: var(--diff-add);
    text-decoration: none;
    padding: 0 2px;
    border-radius: 2px;
}
.para-diff del {
    background: var(--diff-del);
    text-decoration: line-through;
    padding: 0 2px;
    border-radius: 2px;
}

/* ── Agents Table ────────────────────────────────────────── */

.agents-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    line-height: 1.5;
    table-layout: fixed;
}

.agents-table thead th {
    background: #f1f5f9;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.4rem 0.6rem;
    border-bottom: 2px solid var(--border);
    text-align: left;
    white-space: normal;
}

.th-tokens {
    display: block;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--info);
    font-size: 0.68rem;
    margin-top: 0.12rem;
    font-variant-numeric: tabular-nums;
}
.th-tokens:empty { display: none; }

.agents-table tbody tr {
    border-bottom: 1px solid var(--border-light);
}
.agents-table tbody tr:last-child {
    border-bottom: none;
}

.agents-loop-label-row td {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.35rem 0.6rem 0.1rem;
    border-bottom: none;
    background: #f8fafc;
}

.agent-cell {
    padding: 0.5rem 0.6rem;
    vertical-align: top;
    color: #475569;
    border-right: 1px solid var(--border-light);
}
.agent-cell:last-child { border-right: none; }

.agents-relecteur-details-row td {
    background: #f8fafc;
    border-top: none;
}
.agent-cell--relecteur-full {
    width: 100%;
    padding: 0.55rem 0.8rem 0.7rem;
    word-break: break-word;
}
.relecteur-verif + .relecteur-verif {
    margin-top: 0.55rem;
    padding-top: 0.45rem;
    border-top: 1px dashed var(--border-light);
}

.agent-pending {
    color: var(--text-muted);
    font-style: italic;
}

.agent-spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
    color: var(--primary);
    font-weight: 600;
}

.agent-count {
    display: inline-block;
    font-weight: 600;
    color: var(--info);
    font-size: 0.72rem;
    margin-bottom: 0.2rem;
}

.agent-details {
    background: #f8fafc;
    border-radius: 4px;
    padding: 0.3rem 0.5rem;
    margin-top: 0.2rem;
    font-size: 0.76rem;
    max-height: 6rem;
    overflow-y: auto;
    word-break: break-word;
}

.agent-more {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-style: italic;
}

.agent-ok {
    color: var(--success);
    font-weight: 500;
    font-size: 0.75rem;
}

.agent-error {
    display: block;
    color: var(--danger);
    font-weight: 600;
    font-size: 0.75rem;
    margin-bottom: 0.2rem;
    white-space: normal;
    word-break: break-word;
}

.agent-score {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.72rem;
}
.agent-score--good { background: #dcfce7; color: #16a34a; }
.agent-score--bad { background: #fef3c7; color: #d97706; }

.agent-iter {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.relecteur-explication {
    font-size: 0.72rem;
    line-height: 1.4;
    color: var(--text, #334155);
    font-style: italic;
    margin: 0.25rem 0;
    padding: 0.3rem 0.45rem;
    background: #f8fafc;
    border-left: 3px solid #94a3b8;
    border-radius: 3px;
}

.relecteur-divergences {
    margin: 0.2rem 0 0.3rem;
    padding-left: 1rem;
    font-size: 0.7rem;
    line-height: 1.4;
    color: #b45309;
}
.relecteur-divergences .divergence-type {
    font-weight: 700;
    text-transform: capitalize;
}

.diff-del {
    text-decoration: line-through;
    color: var(--danger);
    background: var(--diff-del);
    padding: 0 2px;
    border-radius: 2px;
}

.diff-add {
    font-weight: 600;
    color: #166534;
    background: var(--diff-add);
    padding: 0 2px;
    border-radius: 2px;
}

/* ── LaTeX summary ───────────────────────────────────────── */

.latex-summary {
    font-size: 0.82rem;
}

.latex-preview {
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 0.5rem 0.6rem;
    margin-top: 0.3rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.7rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 10rem;
    overflow-y: auto;
    color: #475569;
}

/* ── Comments ─────────────────────────────────────────────── */

.para-comments { margin-top: 0.4rem; }
.comment {
    padding: 0.3rem 0.5rem;
    margin-bottom: 0.25rem;
    border-radius: 6px;
    font-size: 0.75rem;
    line-height: 1.4;
}
.comment-humain { background: #fffbeb; border-left: 3px solid var(--warning); }
.comment-agent { background: #f0f9ff; border-left: 3px solid var(--info); }
.comment-agent_relecteur_fond { background: #fdf2f8; border-left: 3px solid #a855f7; }
.comment-agent_relecteur_fond .comment-author {
    display: block;
    color: #7e22ce;
    margin: 0 0 0.25rem;
}
.comment-agent_relecteur_fond .comment-text {
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
}
.comment-gdoc { background: #f0fdf4; border-left: 3px solid #16a34a; }
.comment-gdoc .comment-author { color: #15803d; }
.comment--traite { opacity: 0.55; }
/* ── Historique des exports GDoc ── */
/* ── Onglets projet (paramètres / absents / analyse) ── */
.projet-tabs {
    margin: 0.5rem 0 1rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.projet-tabs-bar {
    display: inline-flex;
    gap: 0.2rem;
    background: #e2e8f0;
    border-bottom: none;
    padding: 0.25rem;
    border-radius: 10px;
    margin: 0.5rem 0.5rem 0;
    flex-wrap: wrap;
}
.projet-tab {
    background: transparent;
    border: none;
    padding: 0.38rem 0.9rem;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    color: #64748b;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.12s, color 0.12s, box-shadow 0.12s;
    white-space: nowrap;
}
.projet-tab:hover {
    background: rgba(255,255,255,0.6);
    color: #0f172a;
}
.projet-tab--active {
    background: #fff;
    color: var(--primary);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(15,23,42,0.12);
}
.projet-tab--active:hover {
    background: #fff;
    color: var(--primary);
}
.projet-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: #ea8a3a;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
}
.projet-tab--active .projet-tab-badge {
    background: var(--primary);
    color: #fff;
}
.projet-tab-panel {
    padding: 0.75rem 1rem 1rem;
}
.projet-tab-panel[hidden] { display: none; }
#tabPanelEtapes {
    padding: 0.55rem 0.55rem 0.65rem;
}
.projet-tab-panel .usage-summary {
    display: inline-flex;
    margin-bottom: 0.85rem;
}
.usage-table-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0 0 0.55rem;
}
.usage-table-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
}
.usage-couts-link {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
}
.usage-couts-link:hover {
    text-decoration: underline;
}
.projet-tab-panel-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.35rem;
}
.btn-tab-collapse {
    width: 1.6rem;
    height: 1.6rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
}
.btn-tab-collapse:hover { border-color: var(--primary); }
.projet-tab-empty {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}
#paramsTabBody[hidden] { display: none; }
.projet-tab-panel .orphelins-panel,
.projet-tab-panel .nouveaux-panel {
    margin-top: 0.5rem;
}
.projet-tab-panel .orphelins-panel:first-child,
.projet-tab-panel .nouveaux-panel:first-child,
.projet-tab-panel .projet-tab-empty + .nouveaux-panel,
.projet-tab-panel .projet-tab-empty + .orphelins-panel {
    margin-top: 0;
}

/* Groupe de lancement mode auto */
.auto-mode-alert {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    color: #92400e;
    font-size: 0.82rem;
    padding: 0.4rem 0.75rem;
}
.gdoc-pdf-status {
    font-size: 0.75rem;
    color: var(--text-muted, #64748b);
}

.gdoc-history-wrap {
    width: 100%;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}
.gdoc-history-list {
    list-style: none;
    margin: 0;
    padding: 0.2rem 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    max-height: 4.6rem;
    overflow-y: auto;
    font-size: 0.58rem;
    line-height: 1.25;
    text-align: left;
}
.gdoc-history-item {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    padding: 0.15rem 0.25rem;
    border-radius: 4px;
}
.gdoc-history--ok  { background: #f0fdf4; }
.gdoc-history--err { background: #fef2f2; }
.gdoc-history-ts {
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}
.gdoc-history-detail { color: #64748b; }
.gdoc-history-empty  { color: #94a3b8; font-style: italic; padding: 0.2rem 0.25rem; }

.gdoc-comment-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.3s, color 0.3s;
}
.gdoc-comment-badge--done {
    background: #f0fdf4;
    color: #166534;
    border-color: #4ade80;
    opacity: 0.75;
}
.gdoc-comment-badge--done::after {
    content: ' ✓';
}

.fc-gate-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fc-gate-badge--pending {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}
.fc-gate-badge--yes {
    background: #fef3c7;
    color: #b45309;
    border-color: #fcd34d;
}
.fc-gate-badge--no {
    background: #f1f5f9;
    color: #64748b;
    border-color: #e2e8f0;
}

/* ── GDoc comments global stats (dashboard) ─────────────── */
.gdoc-comments-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 6px;
    font-size: 0.78rem;
    color: #15803d;
    margin-top: 0.5rem;
    flex: 1 0 100%;
}
.gdoc-stats-label { font-weight: 600; }
.gdoc-stats-sep   { color: #86efac; }
.gdoc-stats-done  { transition: color 0.3s; }

.gdoc-sync-banner {
    margin-top: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: #eff6ff;
    border: 1px solid #93c5fd;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #1d4ed8;
    scroll-margin-top: calc(var(--navbar-height) + var(--dashboard-offset) + 8px);
}
.gdoc-sync-banner--error {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #b91c1c;
}

.orphelins-panel {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: #fff4e5;
    border: 1px solid #ea8a3a;
    border-left: 5px solid var(--warning);
    border-radius: 8px;
    scroll-margin-top: calc(var(--navbar-height) + var(--dashboard-offset) + 8px);
}
.orphelins-header {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    color: #9a3412;
}
.orphelins-count {
    font-size: 0.8rem;
    color: #c2410c;
}
.orphelins-hint {
    margin: 0.35rem 0 0.65rem;
    font-size: 0.8rem;
    color: #9a3412;
}
.orphelins-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 16rem;
    overflow-y: auto;
}
.orphelin-card {
    background: #fff;
    border: 1px solid #fed7aa;
    border-radius: 6px;
    padding: 0.55rem 0.7rem;
}
.orphelin-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.3rem;
}
.orphelin-apercu {
    font-size: 0.82rem;
    color: #444;
    margin: 0 0 0.45rem;
    white-space: pre-wrap;
}
.btn-reinserer-gdoc {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.7rem;
    border: 1px solid #c2410c;
    color: #c2410c;
    background: #fff;
    border-radius: 5px;
    cursor: pointer;
}
.btn-reinserer-gdoc:hover:not(:disabled) {
    background: #c2410c;
    color: #fff;
}
.btn-reinserer-gdoc:disabled {
    opacity: 0.6;
    cursor: default;
}
.orphelin-status {
    margin-left: 0.5rem;
    font-size: 0.75rem;
    color: #9a3412;
}

.nouveaux-panel {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    scroll-margin-top: calc(var(--navbar-height) + var(--dashboard-offset) + 8px);
}
.nouveaux-header {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    color: #166534;
}
.nouveaux-count {
    font-size: 0.8rem;
    color: #15803d;
}
.nouveaux-hint {
    margin: 0.35rem 0 0.65rem;
    font-size: 0.8rem;
    color: #166534;
}
.nouveaux-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 16rem;
    overflow-y: auto;
}
.nouveau-card {
    background: #fff;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 0.55rem 0.7rem;
}
.btn-voir-para {
    display: inline-block;
    margin-top: 0.35rem;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #166534;
    background: #fff;
    border: 1px solid #16a34a;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
}
.btn-voir-para:hover {
    background: #16a34a;
    color: #fff;
}
.comment-author {
    font-weight: 600;
    margin-right: 0.4rem;
    text-transform: capitalize;
}

/* ── Relecture de fond (pleine largeur du paragraphe) ── */

.relecture-fond-comments {
    width: 100%;
    margin: 0 0 0.65rem;
    padding: 0.55rem 0.65rem;
    background: #faf5ff;
    border: 1px solid #e9d5ff;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    box-sizing: border-box;
}
.relecture-fond-comments[hidden] { display: none; }
.relecture-fond-comments .para-cell-label { color: #7e22ce; }
.relecture-fond-comments .comment-agent_relecteur_fond {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0;
}
.relecture-fond-comments .remarque-fond { margin-bottom: 0; }

.relecture-fond-chapitre {
    background: #faf5ff;
    border: 1px solid #d8b4fe;
    border-left: 4px solid #a855f7;
    border-radius: var(--radius);
    padding: 0.85rem 1rem 0.95rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    box-shadow: var(--shadow);
    scroll-margin-top: calc(var(--navbar-height) + var(--dashboard-offset) + 8px);
}
.relecture-fond-chapitre[hidden] { display: none; }
.relecture-fond-chapitre .para-cell-label { color: #7e22ce; margin: 0; }
.relecture-fond-chapitre-head { display: flex; flex-direction: column; gap: 0.15rem; }
.relecture-fond-chapitre-hint {
    margin: 0;
    font-size: 0.72rem;
    color: #7e22ce;
    opacity: 0.8;
}
.fond-renvoi {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #7e22ce;
    background: #f3e8ff;
    border: 1px solid #e9d5ff;
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    text-decoration: none;
    white-space: nowrap;
}
.fond-renvoi:hover { background: #ede9fe; color: #6b21a8; }

.relecture-fond-panel {
    grid-column: 1 / -1;
    background: #faf5ff;
    border-top: 2px solid #a855f7;
    padding: 0.8rem 1rem;
}
.relecture-fond-panel .para-cell-label { color: #7e22ce; }

.remarque-fond {
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.3rem;
    border-radius: 6px;
    font-size: 0.78rem;
    line-height: 1.5;
    background: #fff;
    border-left: 3px solid #d8b4fe;
}
.remarque-fond--important { border-left-color: #dc2626; background: #fef2f2; }
.remarque-fond--attention { border-left-color: #f59e0b; background: #fffbeb; }
.remarque-fond--info { border-left-color: #a855f7; background: #faf5ff; }

.remarque-fond-axe {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    margin-right: 0.3rem;
}
.remarque-fond-axe--acceptabilite { background: #fce7f3; color: #be185d; }
.remarque-fond-axe--pertinence { background: #dbeafe; color: #1d4ed8; }
.remarque-fond-axe--ambiguite { background: #fef3c7; color: #92400e; }
.remarque-fond-axe--clarte { background: #e0f2fe; color: #0369a1; }
.remarque-fond-axe--contradiction { background: #fee2e2; color: #dc2626; }
.remarque-fond-axe--clarification { background: #ede9fe; color: #5b21b6; }

.remarque-fond-gravite {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    margin-right: 0.3rem;
}
.remarque-fond-gravite--important { background: #fee2e2; color: #dc2626; }
.remarque-fond-gravite--attention { background: #fef3c7; color: #d97706; }
.remarque-fond-gravite--info { background: #f3e8ff; color: #7e22ce; }

.remarque-fond-texte { margin-top: 0.2rem; color: var(--text); }
.remarque-fond-extrait {
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.74rem;
    margin-top: 0.15rem;
}
.remarque-fond-suggestion {
    color: #16a34a;
    font-size: 0.74rem;
    margin-top: 0.15rem;
}

.relecture-fond-synthese {
    padding: 0.4rem 0.6rem;
    background: #fff;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text);
    font-style: italic;
    border-left: 3px solid #a855f7;
}

.relecture-fond-count {
    font-size: 0.72rem;
    font-weight: 600;
    color: #7e22ce;
    margin-bottom: 0.15rem;
}

.relecture-fond-remarques {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 22rem;
    overflow-y: auto;
    padding-right: 0.3rem;
    overscroll-behavior: contain;
}
.relecture-fond-remarques .remarque-fond {
    margin-bottom: 0;
}

/* ── Modal ────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.modal {
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal h3 { margin-bottom: 1rem; }
.modal-lg { max-width: 1000px; padding: 1rem; }
.modal-prompt {
    max-width: 820px;
    width: min(92vw, 820px);
    padding: 1rem 1.1rem 0.9rem;
}
.prompt-modal-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0 0 0.45rem;
    min-height: 1.1em;
}
.prompt-modal-textarea {
    width: 100%;
    min-height: 22rem;
    max-height: 62vh;
    font-size: 0.78rem;
    line-height: 1.45;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem 0.7rem;
    resize: vertical;
    box-sizing: border-box;
    color: var(--text);
    background: #fff;
}
.prompt-modal-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.prompt-modal-feedback {
    font-size: 0.82rem;
    margin: 0.5rem 0 0;
    padding: 0.35rem 0.55rem;
    border-radius: 5px;
    background: #eff6ff;
    color: #1d4ed8;
}
.prompt-modal-feedback--ok {
    background: #f0fdf4;
    color: #15803d;
}
.prompt-modal-feedback--err {
    background: #fef2f2;
    color: #dc2626;
}
.prompt-toast {
    position: fixed;
    right: 1.1rem;
    bottom: 1.1rem;
    z-index: 300;
    max-width: 22rem;
    padding: 0.7rem 0.9rem;
    border-radius: 8px;
    background: #1e293b;
    color: #fff;
    font-size: 0.82rem;
    line-height: 1.4;
    box-shadow: 0 8px 24px rgba(15,23,42,.25);
}
.modal-prompt .form-actions {
    margin-top: 0.75rem;
    justify-content: space-between;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

/* ── Animations ───────────────────────────────────────────── */

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
.para-row--processing {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes highlight-row {
    0% { background: #dbeafe; }
    100% { background: var(--bg-card); }
}
.para-row--updated {
    animation: highlight-row 1s ease;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Paragraph images ─────────────────────────────────────── */

.para-images {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: var(--bg-card, #f8fafc);
    border-radius: 8px;
    border: 1px solid var(--border-light, #e2e8f0);
}
.para-image-figure {
    margin: 0;
    flex: 0 1 auto;
    max-width: 100%;
    text-align: center;
}
.para-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 6px;
    object-fit: contain;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    transition: transform 0.2s;
    cursor: zoom-in;
}
.para-image:hover {
    transform: scale(1.03);
}
.para-image-caption {
    font-size: 0.8rem;
    color: var(--text-muted, #64748b);
    margin-top: 0.35rem;
    font-style: italic;
    line-height: 1.3;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 1100px) {
    .para-top-row { grid-template-columns: 1fr; }
    .para-bottom-row { grid-template-columns: 1fr; }
    .para-cell--avant { border-right: none; border-bottom: 1px solid var(--border-light); }
    .para-cell--diff { border-right: none; border-bottom: 1px solid var(--border-light); }
    .container { padding: 1rem; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .settings-cluster,
    .launch-cluster,
    .export-cluster { width: 100%; max-width: none; }
    .pipeline-group-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
    .pipeline-steps--improve {
        grid-template-columns: 1fr 1fr;
    }
    .pipeline-steps--improve .pipeline-group-actions {
        grid-column: 1 / -1;
    }
    .pipeline-steps--improve .step:nth-child(2n) { border-right: none; }
    .settings-agents { grid-template-columns: 1fr 1fr; }
    .settings-step:nth-child(2n) { border-right: none; }
    .settings-step:nth-child(n + 3) { border-top: 1px solid var(--border); }
    .toolbar-meta { margin-left: 0; }
    .pipeline-board { flex-wrap: wrap; }
    .pipeline-group { flex: 1 1 100%; }
    .pipeline-steps { flex-wrap: wrap; }
    .step {
        flex: 1 1 22%;
        border-bottom: 1px solid var(--border);
    }
    .step:nth-child(4n) { border-right: none; }
    .export-group { margin-left: 0; flex-wrap: wrap; }
    .dashboard { margin: -1rem -1rem 1rem -1rem; padding: 0.5rem 1rem; }
    .dashboard-bottom { flex-direction: column; align-items: stretch; }
    .dashboard-active { flex: 1 1 auto; min-width: 0; }
    .dashboard-analyse { max-width: none; min-width: 0; }
    .dashboard-progress { flex: none; }
    .dashboard-bar .dashboard-progress { flex: 1; min-width: 0; }
    .active-texte-cell { max-width: 150px; }
}

/* ── Scrollbar ────────────────────────────────────────────── */

.agent-details::-webkit-scrollbar,
.latex-preview::-webkit-scrollbar { width: 4px; }
.agent-details::-webkit-scrollbar-track,
.latex-preview::-webkit-scrollbar-track { background: transparent; }
.agent-details::-webkit-scrollbar-thumb,
.latex-preview::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

/* ── Page coûts ───────────────────────────────────────────── */

.couts-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.couts-intro {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 40rem;
    margin-top: 0.35rem;
}
.couts-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}
.couts-filter select {
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
}
.couts-totaux {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.couts-stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1.1rem;
    min-width: 10rem;
    box-shadow: var(--shadow);
}
.couts-stat-label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 700;
}
.couts-stat-value {
    display: block;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin-top: 0.15rem;
}
.couts-stat-sub {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}
.couts-card {
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
}
.couts-card h2 {
    font-size: 1.05rem;
    margin-bottom: 0.75rem;
}
.couts-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.couts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.couts-table th,
.couts-table td {
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
}
.couts-table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.couts-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.couts-table code {
    font-size: 0.8rem;
}
.couts-empty {
    color: var(--text-muted);
    font-style: italic;
}

/* ── Page paramètres : agents ─────────────────────────────── */

/* ── Agents matrix table ───────────────────────────────────────── */
.agents-matrix-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0.25rem;
}
.agents-matrix-table {
    border-collapse: collapse;
    min-width: max-content;
    width: 100%;
}
.agents-matrix-table th,
.agents-matrix-table td {
    border: 1px solid var(--border);
    padding: 0.4rem 0.65rem;
    vertical-align: middle;
}
.agents-matrix-model-th {
    background: var(--bg);
    font-weight: 600;
    white-space: nowrap;
    min-width: 13rem;
    font-size: 0.82rem;
}
.agents-matrix-agent-th {
    text-align: center;
    background: var(--bg);
    min-width: 5.5rem;
    max-width: 7rem;
    padding: 0.55rem 0.4rem;
    transition: opacity 0.2s;
}
.agents-matrix-agent-name {
    font-size: 0.72rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    white-space: normal;
    word-break: break-word;
    line-height: 1.2;
}
.agents-matrix-del-th {
    width: 2rem;
    border-color: transparent !important;
    background: transparent !important;
}
.agents-matrix-model-name {
    font-family: monospace;
    font-size: 0.82rem;
    white-space: nowrap;
    background: var(--bg);
    font-weight: 500;
}
.agents-matrix-model-name--edit { background: var(--bg-card); }
.agents-matrix-radio-cell {
    text-align: center;
    transition: opacity 0.2s;
}
.agents-matrix-radio-cell input[type=radio] {
    width: 1.05rem;
    height: 1.05rem;
    cursor: pointer;
    accent-color: var(--primary);
    display: block;
    margin: 0 auto;
}
.agents-matrix-del-cell {
    border-color: transparent !important;
    text-align: center;
    background: transparent !important;
    padding: 0 0.3rem !important;
}
.btn-del-model-row {
    background: none;
    border: none;
    color: var(--danger, #ef4444);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.2rem 0.35rem;
    border-radius: 4px;
    opacity: 0.5;
    transition: opacity 0.15s;
    line-height: 1;
}
.btn-del-model-row:hover { opacity: 1; }
.agents-matrix-add-cell {
    border-top: 2px dashed var(--border) !important;
    text-align: left;
    padding: 0.45rem 0.65rem !important;
    background: transparent;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
}
.btn-add-model-row {
    background: none;
    border: 1px dashed var(--primary);
    color: var(--primary);
    font-size: 0.82rem;
    padding: 0.3rem 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.btn-add-model-row:hover {
    background: var(--primary);
    color: #fff;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 2.2rem;
    height: 1.2rem;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: #8b97a8;
    border-radius: 1rem;
    transition: background 0.2s;
    cursor: pointer;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 0.85rem;
    height: 0.85rem;
    background: #fff;
    border-radius: 50%;
    left: 0.18rem;
    top: 0.175rem;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(1rem); }

/* Model presets */
.model-preset-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.model-preset-label { cursor: pointer; }
.model-preset-label input[type="radio"] { display: none; }
.model-preset-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 99px;
    font-size: 0.75rem;
    font-family: monospace;
    background: var(--bg);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}
.model-preset-badge--custom { font-family: inherit; font-style: italic; }
.model-preset-label input:checked + .model-preset-badge {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.param-input--sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.82rem;
    width: 14rem;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--bg-card);
}
.param-key-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-family: monospace;
    margin: 0;
}

/* ── Graphe latences ──────────────────────────────────────── */

.latency-chart-wrap {
    position: relative;
    max-height: 320px;
}

/* ── Panneau tarification ─────────────────────────────────── */

.couts-pricing-card {
    background: var(--bg);
    border: 1px solid var(--border);
}
.couts-pricing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}
.couts-pricing-table {
    margin-top: 0;
}
.couts-pricing-table input.price-input {
    width: 6rem;
    text-align: right;
    padding: 0.25rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-card);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    transition: border-color 0.15s;
}
.couts-pricing-table input.price-input:focus {
    outline: none;
    border-color: var(--primary);
}
.btn-sm {
    font-size: 0.78rem;
    padding: 0.25rem 0.65rem;
}

.para-pager {
    position: relative;
    z-index: 95;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 0.75rem 0;
    font-size: 0.85rem;
    scroll-margin-top: calc(var(--navbar-height) + var(--dashboard-offset) + 8px);
}
.para-pager-info {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.para-pager-btn {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.8rem;
}
.para-pager-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.para-pager-btn--disabled {
    opacity: 0.4;
    cursor: default;
}

/* ── Filter bar ────────────────────────────────────────────────── */
.para-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 2.2rem;
    padding: 0 0.25rem;
    margin-bottom: 0.25rem;
}
.para-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.85rem;
    background: #fff8ec;
    border: 1px solid var(--warn, #d97706);
    border-radius: 99px;
    color: var(--warn, #b45309);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.para-filter-btn:hover {
    background: var(--warn, #d97706);
    color: #fff;
}
.para-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.85rem;
    border-radius: 99px;
    font-size: 0.82rem;
    font-weight: 600;
}
.para-filter-tag--escalade {
    background: #fff8ec;
    border: 1px solid var(--warn, #d97706);
    color: var(--warn, #b45309);
}
.para-filter-clear {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.para-filter-clear:hover {
    color: var(--text);
    background: var(--border);
}

/* ── Navigation par chapitres ─────────────────────────────── */

.chapitre-nav {
    margin: 0.35rem 0 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.55rem 0.7rem 0.65rem;
}
.chapitre-nav-caption {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}
.chapitre-nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    max-height: 14rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.chapitre-nav-item {
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
    padding: 0.38rem 0.65rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    font-size: 0.88rem;
    line-height: 1.35;
}
.chapitre-nav-item:hover {
    background: #fffbeb;
}
.chapitre-nav-item--active {
    background: #fde68a;
    font-weight: 600;
}
.chapitre-nav-item--active:hover {
    background: #fcd34d;
}
.chapitre-nav-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chapitre-nav-meta {
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.chapitre-nav-item--active .chapitre-nav-meta {
    color: #92400e;
}
.chapitre-nav-dot {
    flex: 0 0 auto;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #7e22ce;
    background: #f3e8ff;
    border-radius: 999px;
    padding: 0.05rem 0.4rem;
}

.chapitre-workspace {
    margin-bottom: 1.25rem;
}
.chapitre-vues {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
}
.chapitre-vue-tab {
    appearance: none;
    border: 1px solid var(--border);
    border-bottom: none;
    background: #e8eef0;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    padding: 0.7rem 1rem;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 2.75rem;
}
.chapitre-vue-tab:hover {
    background: #dde6e8;
    color: var(--text);
}
.chapitre-vue-tab--active[data-vue="analyse"] {
    background: #f3e8ff;
    color: #6b21a8;
    border-color: #d8b4fe;
}
.chapitre-vue-tab--active[data-vue="paragraphes"] {
    background: var(--bg-card);
    color: var(--primary);
    border-color: var(--border);
}
.chapitre-vue-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: #c4b5fd;
    color: #4c1d95;
    font-size: 0.7rem;
    font-weight: 700;
}
.chapitre-vue-tab--active[data-vue="analyse"] .chapitre-vue-badge {
    background: #7e22ce;
    color: #fff;
}
.chapitre-vue-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 0.75rem 0.85rem 1rem;
    box-shadow: var(--shadow);
}
.chapitre-vue-panel[hidden] { display: none; }
#chapitreVueParagraphes {
    scroll-margin-top: calc(var(--navbar-height) + var(--dashboard-offset) + 8px);
}
.chapitre-vue-panel--loading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.12s;
}
.chapitre-analyse-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.chapitre-analyse-empty {
    padding: 1.4rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.chapitre-analyse-list .relecture-fond-chapitre {
    box-shadow: none;
}
.chapitre-analyse-list .relecture-fond-remarques {
    max-height: none;
}

.param-form { margin-top: 0.5rem; }
.agents-matrix-prompt-label { font-size: 0.82rem; }
.agents-matrix-prompt-cell { text-align: center; padding: 0.4rem !important; }
.agents-prompt-btn {
    font-size: 0.72rem;
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
    font-weight: 600;
    background: var(--border);
    color: var(--text-muted);
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
}
.agents-prompt-btn:hover { border-color: var(--primary); }
.agents-prompt-btn--active { background: #dcfce7; color: #15803d; }
.agents-prompt-btn--pending { background: #fef3c7; color: #b45309; }
.agents-prompt-btn--rejected { background: #fee2e2; color: #b91c1c; }
.agents-prompt-btn--readonly {
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--text-muted);
}
.agents-prompt-btn--readonly:hover {
    border-color: var(--primary);
    color: var(--text);
    background: var(--bg);
}
.param-choices {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.param-choice {
    cursor: pointer;
}
.param-choice input { position: absolute; opacity: 0; pointer-events: none; }
.param-choice span {
    display: inline-block;
    min-width: 3rem;
    text-align: center;
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    font-weight: 600;
}
.param-choice input:checked + span {
    border-color: var(--primary);
    background: #eff6ff;
    color: var(--primary);
}
.param-choice:hover span { border-color: var(--primary); }

.param-fieldset {
    border: none;
    margin: 0 0 0.8rem;
    padding: 0;
}
.param-fieldset legend {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}
.param-label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}
.param-key-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0 0 0.4rem;
}
.param-input {
    display: block;
    width: min(28rem, 100%);
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 0.7rem;
    font-size: 0.9rem;
}
.param-check {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    margin-bottom: 0.7rem;
    cursor: pointer;
}

.fc-verdicts {
    margin: 0.2rem 0 0;
    padding-left: 1rem;
    font-size: 0.72rem;
    line-height: 1.4;
}
.fc-badge {
    display: inline-block;
    padding: 0.05rem 0.35rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.fc-badge--confirme { background: var(--success); color: #fff; }
.fc-badge--doute { background: #b45309; color: #fff; }
.fc-badge--contredit { background: var(--danger); color: #fff; }
.fc-badge--non_verifiable { background: #64748b; color: #fff; }
.fc-sources {
    margin-top: 0.15rem;
    font-size: 0.68rem;
}
.fc-sources a { color: var(--primary); }

/* ── Login ────────────────────────────────────────────────── */

.login-card {
    max-width: 26rem;
    margin: 4.5rem auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2.1rem 2.15rem 2.3rem;
    box-shadow: var(--shadow-lg);
}
.login-card h1 {
    font-family: var(--font-display);
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1.25rem;
}
.login-card .flash {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0.6rem 0.75rem;
    background: #fef2f2;
    color: var(--danger);
    border-radius: 8px;
    font-size: 0.88rem;
}
.btn-google {
    width: 100%;
    justify-content: center;
    background: #fff;
    color: var(--text);
    border: 1.5px solid var(--border);
    font-weight: 700;
    padding: 0.7rem 1rem;
}
.btn-google:hover {
    border-color: var(--ink);
    background: #f8fafc;
    color: var(--ink);
}
.dev-login {
    margin-top: 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.dev-login .hint {
    font-size: 0.82rem;
    color: var(--text-muted);
}
.dev-login input[type="email"] {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
}
.dev-login .btn {
    width: 100%;
    justify-content: center;
    background: var(--ink);
    color: #fff;
    padding: 0.65rem 1rem;
}
.dev-login .btn:hover { background: var(--ink-soft); color: #fff; }

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