/* AFeJE ONG — interface d'administration */
:root {
    --navy: #0b2f6b; --blue: #1877f2; --sky: #4599ff; --red: #e4572e; --gold: #e8a33d; --green: #2f8a57;
    --bg: #f3f6fb; --line: #e3e8f0; --muted: #64748b;
    --bs-primary: #1877f2; --bs-primary-rgb: 24, 119, 242;
}
body { font-family: 'Inter', Arial, sans-serif; background: var(--bg); color: #1e293b; font-size: .94rem; }
a { color: var(--blue); }
.btn-primary { --bs-btn-bg: var(--blue); --bs-btn-border-color: var(--blue); --bs-btn-hover-bg: var(--navy); --bs-btn-hover-border-color: var(--navy); --bs-btn-active-bg: var(--navy); --bs-btn-disabled-bg: var(--blue); --bs-btn-disabled-border-color: var(--blue); }
.btn-outline-primary { --bs-btn-color: var(--blue); --bs-btn-border-color: var(--blue); --bs-btn-hover-bg: var(--blue); --bs-btn-hover-border-color: var(--blue); }
.form-control, .form-select { border-color: #d5dde9; }
.form-control:focus, .form-select:focus { border-color: var(--sky); box-shadow: 0 0 0 .2rem rgba(69, 153, 255, .15); }
.form-label { font-weight: 600; font-size: .85rem; color: #334155; }
.required::after { content: ' *'; color: var(--red); }

/* Connexion / installation */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(800px 500px at 90% 0%, rgba(69, 153, 255, .25), transparent 60%), radial-gradient(600px 400px at 0% 100%, rgba(232, 163, 61, .2), transparent 60%), linear-gradient(135deg, #0a2556, #0e4bb3); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 22px; padding: 2.5rem 2rem; box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .45); }

/* Barre latérale */
.admin-sidebar { width: 264px; background: #0a2556; color: rgba(255, 255, 255, .75); display: flex; flex-direction: column; }
@media (min-width: 992px) { .admin-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1030; } .admin-main { margin-left: 264px; } }
@media (max-width: 991.98px) { .admin-sidebar { --bs-offcanvas-width: 264px; background: #0a2556; } }
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1.2rem 1.25rem; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sidebar-brand img { background: #fff; border-radius: 50%; padding: 2px; }
.sidebar-brand strong { color: #fff; font-size: 1.1rem; display: block; line-height: 1.1; }
.sidebar-brand em { color: var(--gold); font-style: normal; }
.sidebar-brand small { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; opacity: .6; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .75rem .75rem 1rem; }
.sidebar-nav .nav-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .14em; color: rgba(255, 255, 255, .4); margin: 1.2rem .75rem .4rem; font-weight: 700; }
.sidebar-nav a { display: flex; align-items: center; gap: .75rem; padding: .55rem .75rem; border-radius: 10px; color: rgba(255, 255, 255, .78); text-decoration: none; font-weight: 500; font-size: .9rem; transition: background .15s, color .15s; }
.sidebar-nav a i { font-size: 1.05rem; opacity: .85; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-nav a.active { background: var(--blue); color: #fff; box-shadow: 0 6px 16px -6px rgba(24, 119, 242, .8); }
.sidebar-nav .badge { background: var(--red); font-size: .7rem; }
.sidebar-foot { padding: 1rem 1.25rem; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar-foot a { color: rgba(255, 255, 255, .7); text-decoration: none; font-size: .85rem; }
.sidebar-foot a:hover { color: #fff; }

/* Contenu */
.admin-topbar { position: sticky; top: 0; z-index: 1020; background: rgba(255, 255, 255, .9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 1rem; padding: .75rem 1.5rem; }
.admin-topbar h1 { font-weight: 700; color: var(--navy); }
.avatar-sm { width: 34px; height: 34px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .8rem; }
.admin-content { padding: 1.5rem; }
@media (max-width: 575.98px) { .admin-content { padding: 1rem; } .admin-topbar { padding: .6rem 1rem; } }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.4rem; box-shadow: 0 1px 3px rgba(11, 47, 107, .04); }
.panel h2 { font-weight: 700; color: var(--navy); }

/* Indicateurs */
.kpi { display: flex; align-items: center; gap: 1rem; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.1rem 1.2rem; text-decoration: none; color: inherit; height: 100%; transition: box-shadow .2s, transform .2s; }
a.kpi:hover { box-shadow: 0 10px 25px -12px rgba(11, 47, 107, .3); transform: translateY(-2px); color: inherit; }
.kpi-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.3rem; background: var(--soft); color: var(--tone); flex-shrink: 0; }
.kpi strong { display: block; font-size: 1.35rem; color: var(--navy); line-height: 1.15; }
.kpi small { color: var(--muted); }
.tone-blue { --tone: var(--blue); --soft: #e7f0fe; }
.tone-red { --tone: var(--red); --soft: #fde8e1; }
.tone-gold { --tone: #c47f16; --soft: #fcf1de; }
.tone-green { --tone: var(--green); --soft: #e3f3ea; }

.bars { display: flex; align-items: flex-end; gap: 4px; height: 180px; padding-top: 10px; border-bottom: 1px solid var(--line); }
.bar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.bar span { display: block; width: 100%; height: max(3px, var(--h)); background: linear-gradient(180deg, var(--sky), var(--blue)); border-radius: 5px 5px 0 0; transition: opacity .2s; }
.bar:hover span { opacity: .75; }
.progress-bar { background: var(--blue); }
.pending-item { display: block; padding: .6rem .8rem; border-radius: 10px; background: #fff8ec; border: 1px solid #f7e2bd; text-decoration: none; color: #1e293b; font-size: .88rem; }
.pending-item small { display: block; color: #b26b00; font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.pending-item:hover { background: #fdf0d8; }
.dot-unread { width: 9px; height: 9px; border-radius: 50%; background: var(--red); display: inline-block; flex-shrink: 0; }

/* Tableaux */
.admin-table { margin: 0; }
.admin-table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; border-bottom-width: 1px; white-space: nowrap; }
.thumb { width: 56px; height: 42px; object-fit: cover; border-radius: 8px; display: inline-grid; place-items: center; background: #eef2f8; color: #94a3b8; }
.img-preview { max-width: 100%; max-height: 180px; border-radius: 10px; border: 1px solid var(--line); }
.current-file { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 12px; padding: .75rem; }
.message-body { background: #f8fafc; border-radius: 12px; padding: 1.2rem; white-space: normal; line-height: 1.7; }
.save-bar { position: sticky; bottom: 0; background: rgba(243, 246, 251, .95); backdrop-filter: blur(6px); padding: 1rem 0; margin-top: 1.5rem; border-top: 1px solid var(--line); z-index: 5; }
.pagination { --bs-pagination-active-bg: var(--navy); --bs-pagination-active-border-color: var(--navy); }

/* Éditeur riche */
.rich-editor { background: #fff; min-height: 280px; font-size: 1rem; }
.ql-toolbar.ql-snow { border-radius: 12px 12px 0 0; border-color: #d5dde9; background: #f8fafc; }
.ql-container.ql-snow { border-radius: 0 0 12px 12px; border-color: #d5dde9; font-family: 'Inter', Arial, sans-serif; }
.ql-editor { min-height: 280px; line-height: 1.7; }
.ql-editor img { max-width: 100%; border-radius: 8px; }
.admin-sidebar, .admin-sidebar.offcanvas-lg { background-color: #0a2556 !important; }

/* ---------- Onglets de langue ---------- */
.lang-tabs .nav-link { font-weight: 600; color: var(--muted); }
.lang-tabs .nav-link.active { color: var(--navy); }
.lang-tabs .fi { display: inline-block; font-size: .65rem; font-weight: 800; letter-spacing: .05em; padding: .1rem .35rem; border-radius: 4px; background: var(--navy); color: #fff; margin-right: .25rem; vertical-align: 1px; }

/* ---------- Médias multiples ---------- */
.media-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; }
.media-admin-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.media-admin-card:has(input[name$="[delete]"]:checked) { opacity: .45; border-color: #dc3545; }
.media-admin-thumb { position: relative; aspect-ratio: 4 / 3; background: #0f172a; display: grid; place-items: center; }
.media-admin-thumb img, .media-admin-thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-admin-video { color: #fff; font-size: 2rem; }
.media-kind { position: absolute; left: 6px; bottom: 6px; background: rgba(0, 0, 0, .7); color: #fff; font-size: .7rem; padding: .1rem .45rem; border-radius: 6px; }
.drag-handle { position: absolute; top: 6px; left: 6px; z-index: 2; background: rgba(255, 255, 255, .9); border-radius: 6px; padding: 0 .2rem; cursor: grab; }
.multi-preview { display: flex; flex-wrap: wrap; gap: .4rem; }
.multi-preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* ---------- Constructeur de formulaires ---------- */
.builder-tabs .nav-link { font-weight: 600; }
.palette-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--muted); margin: .9rem 0 .4rem; }
.palette-items { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; }
.palette-item { display: flex; align-items: center; gap: .45rem; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: .45rem .55rem; font-size: .8rem; font-weight: 500; text-align: left; color: #1e293b; cursor: grab; transition: all .15s; }
.palette-item i { color: var(--blue); }
.palette-item:hover { border-color: var(--sky); background: #f1f7fd; }
.builder-list { display: grid; gap: .6rem; min-height: 120px; }
.builder-card { display: flex; gap: .6rem; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: .8rem .8rem .8rem .4rem; cursor: pointer; position: relative; transition: border-color .15s, box-shadow .15s; }
.builder-card:hover { border-color: #b9cde6; }
.builder-card.is-selected { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(24, 119, 242, .15); }
.builder-card .drag-handle { position: static; background: none; color: #94a3b8; padding: .15rem; }
.builder-card.is-heading { background: #f1f7fd; }
.builder-card.is-pagebreak { background: repeating-linear-gradient(45deg, #fff8ec, #fff8ec 10px, #fff 10px, #fff 20px); padding: .4rem .6rem; align-items: center; }
.builder-card .pb-line { flex: 1; font-size: .8rem; font-weight: 700; color: #b26b00; cursor: grab; }
.builder-actions { display: flex; gap: .15rem; opacity: 0; transition: opacity .15s; }
.builder-card:hover .builder-actions, .builder-card.is-selected .builder-actions, .builder-card:focus-within .builder-actions { opacity: 1; }
.builder-actions .btn { padding: .15rem .35rem; }
.builder-empty { border: 2px dashed #cbd5e1; border-radius: 16px; text-align: center; padding: 3rem 1rem; color: var(--muted); }
.builder-empty i { font-size: 2rem; display: block; margin-bottom: .5rem; }
.min-w-0 { min-width: 0; }
.builder-editor { max-height: calc(100vh - 110px); overflow-y: auto; }
.editor-type { width: 34px; height: 34px; border-radius: 10px; background: #e7f0fe; color: var(--blue); display: grid; place-items: center; }
.opt-row { display: flex; gap: .3rem; align-items: center; margin-bottom: .3rem; }
.opt-row .form-control { min-width: 0; }
.opt-row .opt-pts { max-width: 58px; }
.opt-handle { cursor: grab; color: #94a3b8; }
.cond-box { background: #fff8ec; border: 1px solid #f7e2bd; border-radius: 12px; padding: .7rem; margin-top: .75rem; }
.ext-grid { display: flex; flex-wrap: wrap; gap: .3rem; }
.ext-chip { font-size: .72rem; font-weight: 600; border: 1px solid var(--line); border-radius: 6px; padding: .15rem .4rem; cursor: pointer; }
.ext-chip:has(input:checked) { background: #e7f0fe; border-color: var(--blue); color: var(--navy); }
.ext-chip input { display: none; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; }
.template-card { display: flex; flex-direction: column; gap: .35rem; height: 100%; border: 2px solid var(--line); border-radius: 14px; padding: 1rem; cursor: pointer; transition: all .15s; }
.template-card > i { font-size: 1.6rem; color: var(--blue); }
.template-card small { color: var(--muted); }
.btn-check:checked + .template-card { border-color: var(--blue); background: #f1f7fd; box-shadow: 0 0 0 3px rgba(24, 119, 242, .12); }
.qr-box { width: 200px; height: 200px; padding: 0; }
.qr-box img, .qr-box canvas { width: 200px !important; height: 200px !important; }

/* ---------- Réponses et analyse ---------- */
.answer-list { margin: 0; }
.answer-item { padding: .75rem 0; border-bottom: 1px solid var(--line); }
.answer-item:last-child { border-bottom: 0; }
.answer-item dt { font-weight: 600; color: var(--navy); font-size: .9rem; margin-bottom: .25rem; }
.answer-item dd { margin: 0; }
.answer-item.is-hidden { opacity: .6; }
.answer-section { margin-top: 1rem; padding: .4rem .7rem; background: #f1f7fd; border-radius: 8px; font-weight: 700; color: var(--navy); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.signature-img { max-width: 320px; max-height: 120px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.eval-item { border-bottom: 1px dashed var(--line); padding: .5rem 0; }
.table-wide th, .table-wide td { white-space: nowrap; }
.cell-clip { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.stat-card h3 { color: var(--navy); }
.q-badge { background: var(--navy); color: #fff; font-weight: 800; font-size: .75rem; border-radius: 8px; padding: .3rem .5rem; }
.stat-big { font-size: 2.6rem; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-big small { font-size: 1rem; color: var(--muted); font-weight: 600; }
.heat { background: rgba(24, 119, 242, calc(var(--h) / 100 * .35)); }
.nps-box { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; }
.text-answers { max-height: 420px; overflow-y: auto; display: grid; gap: .5rem; padding-right: .3rem; }
.text-answer { background: #f8fafc; border-left: 3px solid var(--sky); border-radius: 0 10px 10px 0; padding: .6rem .8rem; font-size: .9rem; }
.word-cloud { display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: baseline; }
.word-cloud span { color: var(--blue); font-weight: 700; line-height: 1.2; }
.section-sep { border-left: 4px solid var(--red); padding-left: .6rem; color: var(--navy); }
.print-only { display: none; }
.password-toggle { border-color: #d5dde9; }
@media print {
    .admin-sidebar, .admin-topbar, .no-print, .bulk-bar, .pagination { display: none !important; }
    .admin-main { margin: 0 !important; }
    .admin-content { padding: 0; }
    .print-only { display: block; }
    .panel { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
    .col-xl-8 { width: 100% !important; }
    body { background: #fff; }
}
.aud-box { background: #f8fafc; border: 1px solid var(--line); border-radius: 14px; padding: .9rem; }
.aud-box strong { display: block; font-size: 1.6rem; color: var(--navy); line-height: 1.1; }
.aud-box small { color: var(--muted); }
