﻿/* =========================================
   Styles globaux : back-office + formulaire public
   Palette BRED Banque Populaire
   ========================================= */
:root {
    --bred-navy: #002654;          /* bleu marine profond — sidebar, titres */
    --bred-navy-darker: #001a3d;
    --bred-blue: #00529c;          /* bleu principal — boutons primaires, accents */
    --bred-blue-hover: #003d75;
    --bred-blue-light: #4a9fdc;    /* bleu ciel — survols, gradients */
    --bred-blue-pale: #e6f0f9;     /* fond bleu très clair — surbrillances légères */
    --bred-gray: #f5f6f8;          /* fond gris neutre */
    --bred-text: #1a2b4a;
    --bred-border: #d1d9e6;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--bred-text); background: var(--bred-gray); }

/* ---------- Login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, var(--bred-navy), var(--bred-blue)); padding: 20px; }
.login-card { background: #fff; padding: 36px; border-radius: 16px; width: 100%; max-width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,.15); }
.login-card h1 { margin: 0 0 6px; }
.login-card label { display: block; margin-top: 14px; font-size: 14px; color: #475569; }
.login-card input { display: block; width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; margin-top: 4px; font-size: 15px; }
.login-card button { margin-top: 18px; width: 100%; }

/* ---------- Layout back-office ---------- */
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--bred-navy); color: #e2e8f0; padding: 20px 0; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 20px 20px; border-bottom: 1px solid var(--bred-navy-darker); }
.brand .brand-logo { width: 36px; height: 26px; flex-shrink: 0; }
.brand .brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand .brand-text strong { font-size: 18px; font-weight: 800; letter-spacing: 1.5px; color: #fff; }
.brand .brand-text span { font-size: 9px; letter-spacing: 1.8px; color: var(--bred-blue-light); margin-top: 3px; font-weight: 600; text-transform: uppercase; }
.sidebar nav { display: flex; flex-direction: column; margin-top: 16px; flex: 1; }
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #cbd5e1;
    padding: 12px 20px;
    text-decoration: none;
    font-size: 14px;
    border-left: 3px solid transparent;
    transition: all .15s;
}
.sidebar nav a:hover {
    background: var(--bred-navy-darker);
    color: #fff;
    border-left-color: var(--bred-blue-light);
}
.sidebar nav a.active {
    background: linear-gradient(90deg, rgba(74,159,220,.18), transparent);
    color: #fff;
    border-left-color: var(--bred-blue-light);
}
.sidebar nav a.active .nav-ico { color: var(--bred-blue-light); }
/* Icône Feather blanche, 18×18, alignée verticalement */
.sidebar .nav-ico {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #94a8c4;
    transition: color .15s;
}
.sidebar nav a:hover .nav-ico { color: #fff; }
.sidebar nav a span { font-weight: 500; letter-spacing: .2px; }
/* Badge de notification dans la sidebar : compteur de nouveautés */
.sidebar nav a .nav-badge {
    margin-left: auto;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    line-height: 1.3;
    letter-spacing: 0;
    box-shadow: 0 2px 4px rgba(239,68,68,.4);
    animation: badgePulse 2s ease-in-out infinite;
}
@keyframes badgePulse {
    0%, 100% { box-shadow: 0 2px 4px rgba(239,68,68,.4), 0 0 0 0 rgba(239,68,68,.4); }
    50%      { box-shadow: 0 2px 4px rgba(239,68,68,.4), 0 0 0 6px rgba(239,68,68,0); }
}
.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--bred-navy-darker); font-size: 13px; }
.user-chip { margin-bottom: 8px; padding: 6px 8px; border-radius: 6px; transition: background .15s; }
.user-chip:hover { background: var(--bred-navy-darker); }
.user-chip strong { display: block; }
.logout { color: #f87171; text-decoration: none; font-size: 13px; }
/* overflow: clip contraint la largeur SANS créer de contexte de scroll
   (sinon le position: sticky des panneaux serait cassé) */
.main { display: flex; flex-direction: column; min-width: 0; max-width: 100%; overflow-x: clip; }
.topbar { background: #fff; padding: 16px 28px; border-bottom: 1px solid #e5e7eb; box-shadow: 0 1px 0 rgba(0,0,0,.02); }
.topbar h1 { margin: 0; font-size: 22px; }
.content { padding: 24px 28px; min-width: 0; overflow-x: clip; }

/* ---------- Cartes / tableaux ---------- */
.card { background: #fff; border-radius: 12px; padding: 20px 22px; margin-bottom: 22px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.card h2 { margin: 0 0 14px; font-size: 17px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #f1f5f9; font-size: 14px; vertical-align: top; }
.table th { background: #f8fafc; font-weight: 600; color: #475569; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
.table tr:hover { background: #fafbff; }
.actions form { display: inline; }
.center { text-align: center; }
.muted { color: #64748b; }
.small { font-size: 12px; }

/* ---------- Boutons ---------- */
.btn { display: inline-block; padding: 8px 14px; border-radius: 8px; border: 1px solid #d1d5db; background: #fff; color: #1f2937; cursor: pointer; font-size: 14px; text-decoration: none; transition: all .15s; }
.btn:hover { background: #f8fafc; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.primary { background: var(--bred-blue); color: #fff; border-color: var(--bred-blue); }
.btn.primary:hover { background: var(--bred-blue-hover); }
.btn.success { background: #10b981; color: #fff; border-color: #10b981; }
.btn.success:hover { background: #059669; }
.btn.danger { background: #ef4444; color: #fff; border-color: #ef4444; }
.btn.danger:hover { background: #dc2626; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; filter: grayscale(60%); pointer-events: none; }
/* Force l'attribut hidden à masquer même si .btn impose display:inline-block */
[hidden], .btn[hidden] { display: none !important; }
.card-disabled { opacity: .85; background: #f8fafc; }
.card-disabled textarea[disabled], .card-disabled input[disabled], textarea[disabled], input[disabled] { background: #f1f5f9; color: #94a3b8; cursor: not-allowed; }
.alert.success { background: #d1fae5; color: #065f46; }

/* ---------- Stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: #fff; padding: 18px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.04); border-left: 4px solid var(--bred-blue); }
.stat-card.pending { border-color: #f59e0b; }
.stat-card.validated { border-color: #10b981; }
.stat-card.refused { border-color: #ef4444; }
.stat-card.admin { border-color: var(--bred-blue-light); }
.stat-num { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; color: #64748b; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }

/* ---------- Statuts ---------- */
.status { display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.status-nouveau { background: #dbeafe; color: #1e40af; }
.status-en_verification { background: #fef3c7; color: #92400e; }
.status-verifie_staff { background: #d1fae5; color: #065f46; }
.status-demande_refus { background: #fed7aa; color: #9a3412; }
.status-valide { background: #d1fae5; color: #065f46; }
.status-refuse { background: #fee2e2; color: #991b1b; }
.status-conforme { background: #d1fae5; color: #065f46; }
.status-non_conforme { background: #fee2e2; color: #991b1b; }
.status-en_attente { background: #fef3c7; color: #92400e; }

/* ---------- Formulaires & filtres ---------- */
.filters, .inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input, .inline-form input, .inline-form select, .inline-form textarea,
form input[type=text], form input[type=email], form input[type=tel], form input[type=password],
form input[type=number], form input[type=date], form select, form textarea {
    padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; font-family: inherit;
}
form textarea { width: 100%; min-height: 80px; }
.alert { padding: 10px 14px; border-radius: 8px; margin: 10px 0; }
.alert.error { background: #fee2e2; color: #991b1b; }
.alert.warn { background: #fef3c7; color: #92400e; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; background: var(--bred-blue-pale); color: var(--bred-navy); text-transform: uppercase; }

/* ---------- Détail dossier ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-bottom: 22px; }
.file-row { display: grid; grid-template-columns: 2fr auto 3fr; gap: 12px; align-items: center; padding: 12px; border: 1px solid #e5e7eb; border-radius: 8px; margin-bottom: 10px; }
.notes { list-style: none; padding: 0; }
.notes li { padding: 10px 12px; border-left: 3px solid var(--bred-blue); background: #f8fafc; margin: 8px 0; border-radius: 4px; }

/* ---------- Form builder ---------- */
.builder {
    display: grid;
    /* La largeur de l'inspecteur est pilotée par une variable CSS, ajustable
       via la poignée d'étirement de la vue flow */
    grid-template-columns: 220px 1fr var(--inspector-width, 320px);
    gap: 16px;
    align-items: start;
}
/* Mode vue Flow : on masque l'inspecteur et la grille passe à 2 colonnes
   pour donner toute la largeur au canvas */
body.flow-mode .builder { grid-template-columns: 220px 1fr; }
body.flow-mode .builder-inspector { display: none; }
/* La poignée d'étirement n'a plus de sens si l'inspecteur est masqué */
body.flow-mode .flow-resize-handle { display: none; }
/* Palette et inspecteur collants : restent visibles lors du défilement vertical */
.builder-palette, .builder-inspector {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    position: sticky;
    top: 16px;                 /* décalage sous la topbar */
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    align-self: start;         /* empêche l'étirement vertical qui casse sticky */
}
.builder-canvas {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    /* Empêche le canvas (notamment la vue flow avec son min-width 4000px) de gonfler la colonne
       de la grille parente. overflow:clip (au lieu de hidden) ne crée pas de scroll context
       et préserve le position:sticky des colonnes voisines */
    min-width: 0;
    overflow: clip;
}
.palette-item { padding: 8px 10px; background: var(--bred-blue-pale); border: 1px dashed #9ec5e8; border-radius: 6px; margin: 6px 0; cursor: grab; font-size: 13px; }
.palette-item:hover { background: var(--bred-blue-pale); }
.builder-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.builder-toolbar input { flex: 1; min-width: 140px; }
.steps-container { display: flex; flex-direction: column; gap: 14px; }
.builder-step { border: 2px dashed #cbd5e1; border-radius: 10px; padding: 14px; background: #fafbff; }
.builder-step.drag-over { border-color: var(--bred-blue); background: var(--bred-blue-pale); }
.builder-step.step-dragging { opacity: .5; transform: scale(.98); }
.builder-step-head { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.builder-step-head input { flex: 1; }
.step-handle { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 4px; cursor: grab; color: #94a3b8; user-select: none; font-size: 18px; line-height: 1; }
.step-handle:hover { background: var(--bred-blue-pale); color: var(--bred-blue); }
.step-handle:active { cursor: grabbing; }

/* ---------- Vue Flow : graphe des slides ---------- */
.flow-view {
    position: relative;
    background: var(--bred-navy);
    background-image: radial-gradient(circle, rgba(255,255,255,.05) 1px, transparent 1px);
    background-size: 24px 24px;
    border-radius: 12px;
    overflow: hidden;
    min-height: 70vh;
    /* Le canvas du flow ne déborde plus jamais de sa cellule grille */
    width: 100%;
    max-width: 100%;
    cursor: grab;
}
.flow-view.panning { cursor: grabbing; }
/* Stage transformable (zoom et pan appliqués ici) */
.flow-stage {
    position: relative;
    width: 100%;
    height: 100%;
    transform-origin: 0 0;
    transition: transform .05s linear;
}
.flow-svg { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 1; overflow: visible; }
/* Animation de défilement des connexions pour indiquer la direction du flow */
.flow-connection {
    stroke-dasharray: 8 4;
    animation: flowDash 1.4s linear infinite;
}
@keyframes flowDash {
    to { stroke-dashoffset: -12; }
}
.flow-nodes { position: relative; z-index: 2; min-width: 4000px; min-height: 3000px; overflow: visible; }
/* Barre de contrôles zoom : fixée en haut à droite du flow-view */
.flow-controls {
    position: absolute;
    top: 12px; right: 12px;
    z-index: 30;
    display: flex; gap: 6px; align-items: center;
    background: rgba(15,23,42,.9);
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #334155;
    color: #e2e8f0;
}
.flow-controls .btn { min-width: 32px; padding: 4px 8px; }
.flow-zoom-label { font-size: 12px; font-weight: 600; min-width: 50px; text-align: center; }

/* Poignée d'étirement à droite de la vue flow : agrandit la zone en rétrécissant l'inspecteur */
.flow-resize-handle {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 10px;
    cursor: ew-resize;
    z-index: 40;
    background: linear-gradient(to right, transparent, rgba(255,255,255,.05));
    transition: background .2s;
}
.flow-resize-handle::after {
    content: '⋮⋮';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: #94a3b8;
    font-size: 14px;
    letter-spacing: -3px;
}
.flow-resize-handle:hover, .flow-resize-handle.dragging {
    background: linear-gradient(to right, transparent, rgba(79,70,229,.4));
}
.flow-resize-handle:hover::after, .flow-resize-handle.dragging::after { color: #fff; }
/* Pendant le drag de la poignée, on bloque la sélection de texte */
body.flow-resizing { cursor: ew-resize; user-select: none; }
.flow-node {
    position: absolute;
    width: 240px;
    background: #fff;
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,.3);
    cursor: move;
    user-select: none;
    transition: transform .1s, box-shadow .2s;
    border: 2px solid transparent;
}
.flow-node:hover { border-color: var(--bred-blue); }
.flow-node.dragging { transform: scale(1.03); box-shadow: 0 10px 30px rgba(0,0,0,.45); z-index: 10; }
.flow-node-head { display: flex; align-items: center; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid #f1f5f9; margin-bottom: 6px; }
.flow-node-idx {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px;
    background: var(--bred-blue); color: #fff;
    border-radius: 50%; font-size: 12px; font-weight: 700;
}
.flow-node-fields { list-style: none; padding: 0; margin: 0; font-size: 12px; color: #475569; }
.flow-node-fields li { padding: 2px 0; border-bottom: 1px dotted #e5e7eb; }
.flow-node-fields li:last-child { border-bottom: none; }
.flow-node-tag {
    margin-top: 6px; padding: 3px 8px;
    background: #fef3c7; color: #92400e;
    font-size: 11px; font-weight: 600;
    border-radius: 4px; display: inline-block;
}
.flow-node-summary { background: linear-gradient(135deg, var(--bred-blue-light), var(--bred-blue)); color: #fff; }
.flow-node-summary .flow-node-idx { background: #fff; color: var(--bred-blue); }

.flow-legend {
    position: absolute;
    bottom: 12px; left: 12px;
    background: rgba(15,23,42,.95);
    color: #e2e8f0;
    display: flex; gap: 18px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    z-index: 30;
    border: 1px solid #334155;
}
.dot-line { display: inline-block; width: 24px; height: 3px; vertical-align: middle; margin-right: 6px; border-radius: 2px; }
.dot-line.gray   { background: #94a3b8; }
.dot-line.green  { background: #10b981; }
.dot-line.red    { background: #ef4444; }
.dot-line.purple { background: var(--bred-blue-light); }

/* Étiquette Oui/Non interactive (HTML par-dessus le SVG) */
.flow-link-label {
    position: absolute;
    z-index: 4;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,.3);
    transition: transform .15s;
}
.flow-link-label:hover { transform: scale(1.12); }

/* Bouton "+ Lien" en bas de chaque carte */
.flow-add-link {
    margin-top: 8px;
    padding: 4px 10px;
    background: var(--bred-blue-pale);
    color: var(--bred-blue-hover);
    border: 1px dashed #9ec5e8;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    width: 100%;
    text-align: center;
    transition: all .15s;
}
.flow-add-link:hover { background: var(--bred-blue); color: #fff; border-color: var(--bred-blue); }

/* Éditeur flottant pour modifier/supprimer une branche */
.flow-link-editor {
    position: absolute;
    z-index: 20;
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    width: 260px;
    box-shadow: 0 12px 32px rgba(0,0,0,.4);
    color: #1f2937;
}
.flow-link-editor-head { margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid #e5e7eb; }
.flow-link-editor-head small { display: block; color: #64748b; font-size: 11px; margin-top: 2px; }
.flow-link-editor label { display: block; font-size: 12px; color: #475569; margin-bottom: 8px; }
.flow-link-editor select { width: 100%; padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 4px; margin-top: 4px; }
.flow-link-actions { display: flex; gap: 6px; justify-content: space-between; }

/* Poignée draggable à l'extrémité d'une flèche : permet de la rebrancher */
.flow-arrow-handle {
    position: absolute;
    z-index: 4;
    width: 16px; height: 16px;
    border-radius: 50%;
    cursor: grab;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.4);
    transition: transform .22s cubic-bezier(.34,1.56,.64,1);
}
.flow-arrow-handle:hover { transform: scale(1.3); }
.flow-arrow-handle:active { cursor: grabbing; }
/* État "éclaté" : la poignée a été déplacée par l'effet loupe */
.flow-arrow-handle.spread { z-index: 8; box-shadow: 0 0 0 4px rgba(255,255,255,.4), 0 4px 12px rgba(0,0,0,.5); }
/* Étiquette qui accompagne chaque poignée éclatée */
.spread-label {
    position: absolute;
    z-index: 9;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,.4);
    animation: spreadFadeIn .25s ease;
}
@keyframes spreadFadeIn {
    from { opacity: 0; transform: scale(.7); }
    to   { opacity: 1; transform: scale(1); }
}

/* Poignée mobile qui suit la souris pendant le drag */
.flow-arrow-handle.dragging {
    pointer-events: none;
    z-index: 6;
    transform: scale(1.4);
    box-shadow: 0 0 0 6px rgba(79,70,229,.25), 0 4px 10px rgba(0,0,0,.5);
}

/* Carte survolée pendant un drop de flèche */
.flow-node.drop-target { border-color: var(--bred-blue); box-shadow: 0 0 0 4px rgba(79,70,229,.3), 0 6px 18px rgba(0,0,0,.3); transform: scale(1.02); }

/* Bouton poubelle sur chaque lien : supprime la branche après confirmation */
.flow-delete-btn {
    position: absolute;
    z-index: 5;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #94a3b8;
    color: #94a3b8;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    padding: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,.3);
    opacity: .85;
    transition: transform .15s, opacity .15s, background .15s;
}
.flow-delete-btn:hover {
    opacity: 1;
    transform: scale(1.25);
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    color: #fff !important;
}
.builder-field { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 12px; margin: 6px 0; cursor: grab; display: flex; justify-content: space-between; align-items: center; }
.builder-field.selected { border-color: var(--bred-blue); box-shadow: 0 0 0 2px rgba(79,70,229,.15); }
.builder-field.dragging { opacity: .4; }
.builder-field .label { font-weight: 600; font-size: 14px; }
.builder-field .type { font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: .03em; }
.field-actions { display: flex; gap: 4px; }
.field-actions button { background: none; border: none; cursor: pointer; padding: 4px 6px; font-size: 14px; color: #64748b; }
.field-actions button:hover { color: var(--bred-blue); }
.inspector-row { margin-bottom: 10px; }
.inspector-row label { font-size: 12px; color: #475569; display: block; margin-bottom: 4px; }
.inspector-row input, .inspector-row select, .inspector-row textarea { width: 100%; }

/* ---------- Formulaire public ---------- */
.public-body { background: linear-gradient(135deg, var(--bred-gray), var(--bred-blue-pale)); min-height: 100vh; padding: 30px 16px; }
.public-wrap { max-width: 720px; margin: 0 auto; background: #fff; border-radius: 16px; padding: 30px; box-shadow: 0 20px 50px rgba(0,0,0,.08); position: relative; }

/* Regroupement des actions à droite (Terminer plus tard + Suivant/Envoyer) */
.public-actions-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* Bandeau affiché à la reprise d'un brouillon */
.resume-banner {
    background: linear-gradient(90deg, var(--bred-blue-pale), #fff);
    border-left: 4px solid var(--bred-blue);
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 18px;
    color: var(--bred-navy);
    font-size: 14px;
}
.resume-banner small { color: #64748b; display: block; margin-top: 2px; font-size: 12px; }

.public-header h1 { margin: 0 0 4px; }
.progress { height: 8px; background: #e5e7eb; border-radius: 4px; margin-top: 20px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--bred-blue), var(--bred-blue-light)); width: 0%; transition: width .35s ease; }
.step-indicator { text-align: right; font-size: 12px; color: #64748b; margin-top: 6px; }
.slide { animation: slideIn .35s ease; padding: 20px 0; }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.slide h2 { margin-top: 0; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.field { display: flex; flex-direction: column; }
.field.w-full { grid-column: 1 / -1; }
.field.w-half { grid-column: span 1; }
.field.w-third { grid-column: span 1; }
.field label { font-size: 14px; color: #374151; font-weight: 500; display: block; }
.field input, .field select, .field textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--bred-blue); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
.field .help { color: #64748b; font-size: 12px; margin-top: 4px; }
.field fieldset { border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 14px; }
.field .check { display: block; margin: 4px 0; font-weight: 400; }
.field-h1 { font-size: 28px; margin: 0; }
.field-h2 { font-size: 22px; margin: 0; }
.field-text { color: #475569; }
.img-display { margin: 12px 0; }
.img-display img { display: inline-block; box-shadow: 0 2px 8px rgba(0,0,0,.06); }

/* Vignettes dans l'inspecteur du carrousel */
.carousel-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; margin-bottom: 8px; }
.carousel-thumb { position: relative; }
.carousel-thumb img { width: 100%; height: 60px; object-fit: cover; border-radius: 4px; display: block; }
.carousel-thumb button { position: absolute; top: 2px; right: 2px; padding: 0 6px; font-size: 14px; line-height: 18px; }

/* ---------- Carrousel côté public : style "peek" (image centrale + aperçus latéraux) ---------- */
.img-carousel {
    position: relative;
    margin: 18px 0;
    padding: 24px 0 44px;
    overflow: hidden;
    /* Masque progressif aux bords pour suggérer la continuité */
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 12%, #000 88%, transparent 100%);
            mask-image: linear-gradient(to right, transparent 0, #000 12%, #000 88%, transparent 100%);
}
.carousel-track {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    transition: transform .55s cubic-bezier(.4,.2,.2,1);
    will-change: transform;
}
.carousel-track img {
    /* Taille pilotée par la variable --carousel-size (60 % par défaut) */
    flex: 0 0 var(--carousel-size, 60%);
    max-width: var(--carousel-size, 60%);
    aspect-ratio: 16/9;
    height: auto;
    object-fit: cover;
    border-radius: 12px;
    background: #f1f5f9;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    /* Échelle des images non actives, pilotée par variable */
    transform: scale(var(--carousel-inactive-scale, .82));
    opacity: .55;
    filter: saturate(.85);
    transition: transform .55s cubic-bezier(.4,.2,.2,1), opacity .55s, filter .55s;
    user-select: none;
}
.carousel-track img.active {
    transform: scale(1);
    opacity: 1;
    filter: none;
    box-shadow: 0 14px 30px rgba(0,0,0,.18);
    z-index: 2;
}
/* Flèches de navigation collées aux bords de l'image centrale */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 14px rgba(0,0,0,.12);
    z-index: 3;
    transition: background .2s, transform .15s;
}
.carousel-nav:hover { background: #f8fafc; transform: translateY(-50%) scale(1.06); }
.carousel-nav.prev { left: 14%; }
.carousel-nav.next { right: 14%; }
/* Points indicateurs en bas */
.carousel-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 3;
}
.carousel-dots .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    cursor: pointer;
    transition: background .2s, width .2s;
}
.carousel-dots .dot.active { background: var(--bred-blue); width: 22px; border-radius: 4px; }

@media (max-width: 700px) {
    /* Sur mobile, on force une taille mini lisible si le réglage est trop bas */
    .img-carousel { --carousel-size: max(78%, var(--carousel-size, 78%)); }
    .carousel-nav.prev { left: 4%; }
    .carousel-nav.next { right: 4%; }
}
.dropzone { margin-top: 6px; border: 2px dashed #9ec5e8; border-radius: 10px; padding: 22px; text-align: center; background: #f8fafc; cursor: pointer; transition: all .2s; }
.dropzone.drag-over { background: var(--bred-blue-pale); border-color: var(--bred-blue); }
.dropzone p { margin: 0 0 6px; color: #475569; }
.dropzone .dz-title { font-size: 15px; color: #334155; }
.dropzone .dz-or { font-size: 12px; color: #94a3b8; margin: 4px 0; }
.dropzone .dz-browse { margin: 4px auto 8px; }
.dropzone .dz-hint { display: block; margin-top: 6px; }
.dropzone .dz-file { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.dz-file-row {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 6px;
    color: #065f46;
    font-size: 13px;
}
.dz-file-icon { font-weight: 700; }
.dz-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dz-file-size { color: #047857; font-size: 11px; flex-shrink: 0; }
.dz-file-remove {
    background: #fff;
    border: 1px solid #d1d5db;
    color: #64748b;
    width: 22px; height: 22px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px;
    line-height: 1;
    padding: 0;
    transition: all .15s;
    flex-shrink: 0;
}
.dz-file-remove:hover { background: #ef4444; border-color: #ef4444; color: #fff; transform: scale(1.1); }

/* Boutons d'action de la dropzone : Parcourir + Depuis téléphone */
.dz-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 8px 0; }
.dz-mobile { background: linear-gradient(135deg, var(--bred-navy), var(--bred-blue)) !important; color: #fff !important; border-color: transparent !important; }
.dz-mobile:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,38,84,.25); }
/* Ligne de fichier reçu depuis un mobile : bordure et fond bleus pour la distinguer */
.dz-file-row.dz-file-mobile { background: var(--bred-blue-pale); border-color: var(--bred-blue-light); color: var(--bred-navy); }
.dz-file-row.dz-file-mobile .dz-file-size { color: var(--bred-blue); }

/* Modal QR Code */
.qr-modal {
    position: fixed; inset: 0;
    z-index: 10000;
    background: rgba(15,23,42,.75);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.qr-modal[hidden] { display: none !important; }
.qr-modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 28px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    position: relative;
    box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.qr-close {
    position: absolute; top: 12px; right: 12px;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #f1f5f9; border: none;
    font-size: 20px; cursor: pointer; color: #475569;
    transition: all .15s;
}
.qr-close:hover { background: #ef4444; color: #fff; }
.qr-modal-content h3 { margin: 0 0 8px; color: var(--bred-navy); }
.qr-instruction { color: #475569; font-size: 14px; margin: 0 0 18px; }
.qr-image-wrap {
    background: #fff;
    padding: 12px;
    border: 2px solid var(--bred-blue);
    border-radius: 12px;
    display: inline-block;
    margin-bottom: 14px;
}
.qr-image-wrap img { display: block; width: 220px; height: 220px; }
.qr-url { word-break: break-all; font-family: monospace; font-size: 11px; }
.qr-status {
    margin: 12px 0;
    padding: 10px 14px;
    background: var(--bred-blue-pale);
    color: var(--bred-blue);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.qr-pulse {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--bred-blue);
    box-shadow: 0 0 0 0 rgba(0,82,156,.5);
    animation: qrPulse 1.6s infinite;
}
@keyframes qrPulse {
    0%   { box-shadow: 0 0 0 0 rgba(0,82,156,.5); }
    70%  { box-shadow: 0 0 0 12px rgba(0,82,156,0); }
    100% { box-shadow: 0 0 0 0 rgba(0,82,156,0); }
}

/* ---------- TUTOMODE : tutoriel interactif du back-office ---------- */
.tutomode-overlay {
    position: fixed; inset: 0;
    z-index: 9998;
    pointer-events: none;
    opacity: 0;
    transition: opacity .25s;
}
.tutomode-overlay.active { opacity: 1; pointer-events: auto; }

/* Fond noir flouté qui couvre toute la page */
.tutomode-backdrop {
    position: absolute; inset: 0;
    background: rgba(15, 23, 42, .72);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
/* "Trou" lumineux autour de la cible : effet via box-shadow géante */
.tutomode-spotlight {
    position: absolute;
    border-radius: 10px;
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, .72), 0 0 0 4px rgba(79, 70, 229, .8), 0 0 30px rgba(79, 70, 229, .6);
    transition: all .35s cubic-bezier(.4,.2,.2,1);
    pointer-events: none;
    z-index: 9999;
}
/* La spotlight masque déjà le backdrop dans sa zone : on cache le backdrop sous le spotlight */
.tutomode-overlay .tutomode-backdrop { display: none; }

/* Bulle d'aide */
.tutomode-bubble {
    position: absolute;
    background: #fff;
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
    z-index: 10001;
    transition: all .35s cubic-bezier(.4,.2,.2,1);
}
.tutomode-progress { font-size: 11px; color: var(--bred-blue); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.tutomode-title { margin: 0 0 8px; font-size: 16px; color: var(--bred-navy); }
.tutomode-text { margin: 0 0 14px; font-size: 14px; color: #475569; line-height: 1.5; }
.tutomode-buttons { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tutomode-buttons > div { display: flex; gap: 6px; }

/* Flèche pointant vers la cible */
.tutomode-arrow {
    position: absolute;
    width: 0; height: 0;
    z-index: 10000;
    transition: all .35s cubic-bezier(.4,.2,.2,1);
}
.tutomode-arrow.arrow-up    { border-left: 14px solid transparent; border-right: 14px solid transparent; border-bottom: 18px solid #fff; transform: translate(-14px, 0); filter: drop-shadow(0 -2px 4px rgba(0,0,0,.3)); }
.tutomode-arrow.arrow-down  { border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 18px solid #fff; transform: translate(-14px, -18px); filter: drop-shadow(0 2px 4px rgba(0,0,0,.3)); }
.tutomode-arrow.arrow-left  { border-top: 14px solid transparent; border-bottom: 14px solid transparent; border-right: 18px solid #fff; transform: translate(0, -14px); filter: drop-shadow(-2px 0 4px rgba(0,0,0,.3)); }
.tutomode-arrow.arrow-right { border-top: 14px solid transparent; border-bottom: 14px solid transparent; border-left: 18px solid #fff; transform: translate(-18px, -14px); filter: drop-shadow(2px 0 4px rgba(0,0,0,.3)); }

/* Bouton "?" dans la topbar pour relancer */
.tutomode-help-btn {
    position: absolute;
    top: 14px; right: 28px;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--bred-blue);
    color: #fff;
    border: none;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(79,70,229,.3);
    transition: all .15s;
}
.tutomode-help-btn:hover { transform: scale(1.1); background: var(--bred-blue-hover); }
.topbar { position: relative; }
.dropzone.has-file { border-color: #10b981; background: #ecfdf5; }
.field-label { font-size: 14px; color: #374151; font-weight: 500; margin-bottom: 4px; }
.forms-toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 22px; }
.forms-toolbar .card { margin-bottom: 0; }
@media (max-width: 700px) { .forms-toolbar { grid-template-columns: 1fr; } }
/* Champ Oui/Non : deux gros boutons radio stylés */
.yesno { display: flex; flex-wrap: wrap; gap: 10px; border: none; padding: 0; }
.yesno legend { width: 100%; font-size: 14px; color: #374151; font-weight: 500; margin-bottom: 6px; }
.yesno-opt { flex: 1; min-width: 120px; display: flex; align-items: center; justify-content: center; padding: 14px 18px; border: 2px solid #e5e7eb; border-radius: 10px; cursor: pointer; font-weight: 600; background: #fff; transition: all .15s; }
.yesno-opt input { position: absolute; opacity: 0; pointer-events: none; }
.yesno-opt.yes:hover, .yesno-opt.yes:has(input:checked) { border-color: #10b981; background: #ecfdf5; color: #065f46; }
.yesno-opt.no:hover, .yesno-opt.no:has(input:checked) { border-color: #ef4444; background: #fef2f2; color: #991b1b; }

/* Style "radio" classique : pas de boutons stylés, juste des points radio inline */
.yesno-radio .yesno-opt { flex: 0 0 auto; min-width: 0; border: none; background: transparent; padding: 6px 10px; font-weight: 400; }
.yesno-radio .yesno-opt input { position: static; opacity: 1; pointer-events: auto; margin-right: 6px; }
.yesno-radio .yesno-opt:hover, .yesno-radio .yesno-opt:has(input:checked) { background: transparent; color: inherit; border: none; }

/* Style "pills" : petites pastilles arrondies */
.yesno-pills .yesno-opt { flex: 0 0 auto; min-width: 0; padding: 6px 16px; border-radius: 999px; font-size: 13px; }

/* Style "select" : juste un dropdown classique */
.yesno-select { display: block; }
.yesno-select select { width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 15px; }

/* Style "toggle" : interrupteur */
.yesno-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.yesno-toggle input[type=checkbox] { position: absolute; opacity: 0; pointer-events: none; }
.yesno-toggle .slider { position: relative; display: inline-block; width: 52px; height: 28px; background: #e5e7eb; border-radius: 14px; transition: background .2s; }
.yesno-toggle .slider::after { content: ''; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.yesno-toggle input:checked ~ .slider { background: #10b981; }
.yesno-toggle input:checked ~ .slider::after { transform: translateX(24px); }
.yesno-toggle .off, .yesno-toggle .on { color: #94a3b8; font-size: 14px; }
.yesno-toggle input:not(:checked) ~ .off { color: #991b1b; font-weight: 700; }
.yesno-toggle input:checked ~ .on { color: #065f46; font-weight: 700; }
.public-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; padding-top: 18px; border-top: 1px solid #e5e7eb; }
.public-confirm { max-width: 480px; margin: 80px auto; background: #fff; padding: 50px; border-radius: 16px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.08); }
.public-confirm .check { width: 80px; height: 80px; border-radius: 50%; background: #10b981; color: #fff; font-size: 44px; line-height: 80px; margin: 0 auto 20px; }
.summary-section { background: #f8fafc; padding: 14px; border-radius: 8px; margin-bottom: 10px; }
.summary-section h3 { margin: 0 0 6px; font-size: 14px; color: #475569; }
.summary-section dl { display: grid; grid-template-columns: 1fr 2fr; gap: 4px 12px; margin: 0; font-size: 14px; }
.summary-section dt { font-weight: 600; color: #475569; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { display: flex; flex-direction: row; padding: 10px; overflow-x: auto; }
    .sidebar nav { flex-direction: row; margin: 0; flex: 1; }
    .sidebar nav a { padding: 8px 12px; border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; }
    .sidebar-footer { border-top: 0; border-left: 1px solid var(--bred-navy-darker); padding: 8px 12px; }
    .brand { padding: 8px 12px; border: none; }
    .detail-grid { grid-template-columns: 1fr; }
    .builder { grid-template-columns: 1fr; }
    /* Sur mobile, palette et inspecteur reprennent un flux normal */
    .builder-palette, .builder-inspector { position: static; max-height: none; overflow: visible; }
    .fields { grid-template-columns: 1fr; }
    .file-row { grid-template-columns: 1fr; }
    .content { padding: 14px; }
}


