/* ========================================================= */
/* 1. VARIABLES & RESET */
/* ========================================================= */
:root {
 --color-primary: #0ea5e9;
 --color-primary-glow: rgba(14, 165, 233, 0.4);
 --bg-base: #020617;
 --text-base: #f8fafc;
 --panel-bg: rgba(15, 23, 42, 0.72);
 --border-glass: rgba(255, 255, 255, 0.12);

 --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
 --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
 --font-hand: 'Caveat', cursive;

 /* Variables Impression (Agipa PAO) */
 --print-pw: 210mm;
 --print-ph: 297mm;
 --print-mt: 10mm;
 --print-mb: 10mm;
 --print-ml: 10mm;
 --print-mr: 10mm;
 --print-lw: 70mm;
 --print-lh: 37mm;
 --print-gx: 2mm;
 --print-gy: 2mm;
}

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

html,
body {
 height: 100%;
 width: 100%;
 max-width: 100vw;
 margin: 0;
 padding: 0;
 overflow-y: hidden;
 overflow-x: hidden;
 -webkit-tap-highlight-color: transparent;
}

body {
 font-family: var(--font-sans);
 background-color: var(--bg-base);
 color: var(--text-base);
 transition: background-color 0.4s, color 0.4s;
}

h1, h2, h3, h4, h5, .font-heading {
 font-family: var(--font-heading);
}
.font-hand {
 font-family: var(--font-hand);
}

/* Masque proprement les balises img tant que leur src est vide */
img[src=""] {
 visibility: hidden;
}

/* ========================================================= */
/* 1B. FALLBACK STRUCTUREL HORS-TAILWIND (ANDROID CONTENT://) */
/* Garantit un rendu sombre, lisible et navigable même si */
/* le CDN Tailwind est bloqué ou lent sur mobile. */
/* ========================================================= */
#app-wrapper {
 display: flex;
 flex-direction: column;
 width: 100%;
 height: 100%;
 overflow: hidden;
 background-color: var(--bg-base);
 color: var(--text-base);
}

#app-body-shell {
 display: flex;
 flex: 1;
 overflow: hidden;
 position: relative;
 min-height: 0;
}

#sidebar {
 width: 260px;
 background: rgba(10, 15, 30, 0.96);
 border-right: 1px solid var(--border-glass);
 color: #f8fafc;
 display: flex;
 flex-direction: column;
 flex-shrink: 0;
}

#main-view {
 flex: 1;
 overflow-y: auto;
 overflow-x: hidden;
 padding: 16px;
 background: rgba(2, 6, 23, 0.65);
 color: #f8fafc;
 min-width: 0;
}

.glass-panel {
 background: var(--panel-bg);
 border: 1px solid var(--border-glass);
 color: var(--text-base);
}

.btn-primary {
 display: inline-flex;
 align-items: center;
 justify-content: center;
 padding: 8px 14px;
 background-color: var(--color-primary);
 color: #ffffff;
 border: none;
 border-radius: 10px;
 font-size: 12px;
 font-weight: 700;
 cursor: pointer;
}

.btn-secondary {
 display: inline-flex;
 align-items: center;
 justify-content: center;
 padding: 8px 14px;
 background-color: rgba(255, 255, 255, 0.1);
 color: #f8fafc;
 border: 1px solid rgba(255, 255, 255, 0.12);
 border-radius: 10px;
 font-size: 12px;
 font-weight: 700;
 cursor: pointer;
}

.input-glass,
.select-glass {
 background: rgba(15, 23, 42, 0.85);
 border: 1px solid rgba(255, 255, 255, 0.15);
 color: #ffffff;
 border-radius: 10px;
 padding: 9px 12px;
 font-size: 13px;
}

/* --- Scrollbars --- */
::-webkit-scrollbar {
 width: 6px;
 height: 6px;
}
::-webkit-scrollbar-track {
 background: transparent;
}
::-webkit-scrollbar-thumb {
 background: var(--border-glass);
 border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
 background: var(--color-primary);
}
.custom-scrollbar {
 overflow-y: auto;
 overflow-x: hidden;
 -webkit-overflow-scrolling: touch;
}
.custom-scrollbar-x {
 overflow-x: auto;
 overflow-y: hidden;
 -webkit-overflow-scrolling: touch;
}

/* ========================================================= */
/* 2. MODULES DÉPLAÇABLES, CASES ADAPTATIVES & TEXTE (FICHE) */
/* ========================================================= */
.mm-draggable-module {
 transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.mm-draggable-module:hover {
 border-color: rgba(255, 255, 255, 0.18);
}
.mm-draggable-module.mm-dragging {
 opacity: 0.45;
 transform: scale(0.985);
 border-color: var(--color-primary) !important;
 box-shadow: 0 0 0 2px var(--color-primary-glow), 0 18px 40px rgba(0, 0, 0, 0.6);
}
.mm-move-btn {
 width: 26px;
 height: 26px;
 border-radius: 6px;
 display: inline-flex;
 align-items: center;
 justify-content: center;
 font-size: 10px;
 color: #94a3b8;
 background: rgba(255, 255, 255, 0.06);
 border: 1px solid rgba(255, 255, 255, 0.08);
 transition: all 0.15s ease;
 cursor: pointer;
}
.mm-move-btn:hover {
 color: #ffffff;
 background: var(--color-primary);
 border-color: var(--color-primary);
}
.mm-move-btn-dark {
 width: 26px;
 height: 26px;
 border-radius: 6px;
 display: inline-flex;
 align-items: center;
 justify-content: center;
 font-size: 10px;
 color: #0f172a;
 background: rgba(0, 0, 0, 0.12);
 border: 1px solid rgba(0, 0, 0, 0.15);
 transition: all 0.15s ease;
 cursor: pointer;
}
.mm-move-btn-dark:hover {
 background: rgba(0, 0, 0, 0.25);
}

/* #3 : Pile Prénom / Nom anti-débordement */
.mm-name-stack {
 display: flex;
 flex-direction: column;
 align-items: center;
 justify-content: center;
 min-width: 0;
 max-width: 100%;
}
.mm-name-stack > div {
 max-width: 100%;
 overflow-wrap: anywhere;
 word-break: normal;
 hyphens: none;
}

/* #3 & #4 : Conteneur flexible adaptatif qui remplit proprement toute la largeur de ligne */
.mm-flex-cells {
 display: flex;
 flex-wrap: wrap;
 gap: 0.5rem;
 align-items: stretch;
 width: 100%;
}
.mm-cell {
 min-width: 0;
 overflow: hidden;
 transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
.mm-cell-fit {
 flex: 1 1 130px;
 max-width: 100%;
}
.mm-cell-compact {
 flex: 1 1 88px;
 max-width: 100%;
}

/* Adaptation propre du texte aux cellules sans césure au milieu d'un mot */
.mm-autofit {
 max-width: 100%;
 overflow-wrap: break-word;
 word-break: normal;
 hyphens: none;
 white-space: normal;
 line-height: 1.25;
 transition: font-size 0.12s ease-out;
}

/* #1 : Détail de filiation sous le badge lien familial */
#mm-relation-children {
 overflow-wrap: break-word;
 word-break: normal;
}

/* Surbrillance des champs manquants (clic sur jauge compacte) */
@keyframes missingFieldPulse {
 0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); border-color: rgba(251, 191, 36, 0.45); }
 50% { box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.25); border-color: #fbbf24; }
}
.mm-missing-highlight {
 animation: missingFieldPulse 1.1s ease-in-out 3;
 border-color: #fbbf24 !important;
 background-color: rgba(251, 191, 36, 0.08) !important;
}

/* ========================================================= */
/* 3. THÈMES VISUELS ET ARRIÈRE-PLANS */
/* ========================================================= */
.theme-blueprint {
 background-image:
 linear-gradient(var(--border-glass) 1px, transparent 1px),
 linear-gradient(90deg, var(--border-glass) 1px, transparent 1px);
 background-size: 40px 40px;
}
.theme-noise {
 background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
}
.theme-blobs::before,
.theme-blobs::after {
 content: '';
 position: fixed;
 border-radius: 50%;
 filter: blur(120px);
 opacity: 0.2;
 z-index: -1;
 animation: blob 20s infinite alternate ease-in-out;
 pointer-events: none;
}
.theme-blobs::before {
 top: -10%;
 left: -10%;
 width: 50vw;
 height: 50vw;
 background: var(--color-primary);
}
.theme-blobs::after {
 bottom: -10%;
 right: -10%;
 width: 60vw;
 height: 60vw;
 background: #8b5cf6;
 animation-delay: -5s;
}

/* --- Thème Clair (Surcharges Automatiques) --- */
.theme-light {
 --panel-bg: rgba(255, 255, 255, 0.88);
}
.theme-light .text-white { color: #0f172a !important; }
.theme-light .text-slate-200 { color: #1e293b !important; }
.theme-light .text-slate-300 { color: #334155 !important; }
.theme-light .text-slate-400 { color: #475569 !important; }
.theme-light .bg-black,
.theme-light .bg-[#020617] { background-color: #ffffff !important; }
.theme-light .bg-black\/20 { background-color: rgba(255, 255, 255, 0.45) !important; }
.theme-light .bg-black\/30,
.theme-light .bg-black\/40 { background-color: rgba(255, 255, 255, 0.65) !important; }
.theme-light .bg-black\/45,
.theme-light .bg-black\/50 { background-color: rgba(255, 255, 255, 0.72) !important; }
.theme-light .bg-black\/60 { background-color: rgba(255, 255, 255, 0.82) !important; }
.theme-light .bg-black\/80,
.theme-light .bg-black\/90 { background-color: rgba(255, 255, 255, 0.95) !important; }
.theme-light .bg-white\/5 { background-color: rgba(0, 0, 0, 0.03) !important; }
.theme-light .bg-white\/10 { background-color: rgba(0, 0, 0, 0.06) !important; }
.theme-light .bg-white\/15 { background-color: rgba(0, 0, 0, 0.08) !important; }
.theme-light .bg-white\/20 { background-color: rgba(0, 0, 0, 0.1) !important; }
.theme-light .border-white\/5,
.theme-light .border-white\/10,
.theme-light .border-white\/15,
.theme-light .border-white\/20 { border-color: rgba(0, 0, 0, 0.1) !important; }
.theme-light .shadow-inner { box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05) !important; }
.theme-light .shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important; }
.theme-light .shadow-2xl { box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15) !important; }

/* Préserve l'écrin fond noir de la Médiathèque 3D même en thème clair */
.theme-light .fs-mediatheque-void .text-white { color: #f8fafc !important; }
.theme-light .fs-mediatheque-void .text-slate-300 { color: #cbd5e1 !important; }
.theme-light .fs-mediatheque-void .text-slate-400 { color: #94a3b8 !important; }

/* ========================================================= */
/* 4. ANIMATIONS & MODULES 3D */
/* ========================================================= */
@keyframes blob {
 0% { transform: translate(0, 0) scale(1); }
 100% { transform: translate(50px, 50px) scale(1.1); }
}
@keyframes fadeIn {
 from { opacity: 0; transform: translateY(8px); }
 to { opacity: 1; transform: translateY(0); }
}
@keyframes memberSlideNext {
 from { opacity: 0; transform: translateX(22px) scale(0.99); }
 to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes memberSlidePrev {
 from { opacity: 0; transform: translateX(-22px) scale(0.99); }
 to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes memberZoomOpen {
 from { opacity: 0; transform: scale(0.96) translateY(10px); }
 to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes kenburns {
 0% { transform: scale(1) translate(0, 0); }
 100% { transform: scale(1.2) translate(-2%, -2%); }
}

.anim-fade-in { animation: fadeIn 0.4s ease-out forwards; }
.anim-member-next { animation: memberSlideNext 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.anim-member-prev { animation: memberSlidePrev 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.anim-member-open { animation: memberZoomOpen 0.26s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-ken-burns { animation: kenburns 15s ease-out forwards; }

.perspective-1000 { perspective: 1000px; }
.transform-style-3d {
 transform-style: preserve-3d;
 transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.flipped { transform: rotateY(180deg); }
.backface-hidden {
 backface-visibility: hidden;
}
.rotate-y-180 { transform: rotateY(180deg); }

.timeline-item {
 --tl-proximity: 0;
 --tl-opacity: 0.3;
 --tl-scale: 0.9;
 --tl-z: -220px;
 --tl-rot: 14deg;
 transform-style: preserve-3d;
 transition: transform 0.14s ease-out, opacity 0.25s ease, filter 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
 opacity: var(--tl-opacity);
 transform: translateZ(var(--tl-z)) rotateX(var(--tl-rot)) scale(var(--tl-scale));
 filter: grayscale(calc((1 - var(--tl-proximity)) * 80%));
}
.timeline-item.active {
 opacity: 1;
 transform: translateZ(0px) rotateX(0deg) scale(1);
 z-index: 10;
 box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
 filter: grayscale(0%);
 border-color: var(--color-primary);
}

.filter-sepia { filter: sepia(0.85) contrast(1.1) brightness(0.95); }
.filter-vhs { filter: contrast(1.3) saturate(1.8) hue-rotate(-10deg) sepia(0.2); }
.filter-bw { filter: grayscale(1) contrast(1.2); }

.tinder-card {
 position: absolute;
 transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
 transform-origin: 50% 100%;
 cursor: grab;
 user-select: none;
}
.swipe-left { transform: translateX(-200%) rotate(-20deg) scale(0.8); opacity: 0; }
.swipe-right { transform: translateX(200%) rotate(20deg) scale(0.8); opacity: 0; }
.drag-over {
 background: rgba(255, 255, 255, 0.1) !important;
 border: 2px dashed var(--color-primary) !important;
}
.paper-back {
 background-color: #fdf6e3;
 background-image: radial-gradient(#d3c6a5 1px, transparent 0);
 background-size: 20px 20px;
 box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.15);
}

/* ========================================================= */
/* 5. STUDIO D'IMPORTATION (MODAL INDÉPENDANTE RESPONSIVE) */
/* ========================================================= */
#import-studio {
 position: fixed;
 inset: 0;
 height: 100dvh;
 background-color: #1e1e1e;
 color: #f5f5f5;
 z-index: 9999;
 display: flex;
 flex-direction: column;
 transition: transform 0.3s ease-in-out;
 font-family: var(--font-sans);
}
#import-studio.studio-hidden {
 display: none !important;
 transform: translateY(100%);
}
.studio-header {
 display: flex;
 justify-content: space-between;
 align-items: center;
 gap: 12px;
 padding: 12px 16px;
 background-color: #2d2d2d;
 border-bottom: 1px solid #444;
 flex-shrink: 0;
}
.studio-title {
 min-width: 0;
}
.studio-title h2 {
 margin: 0;
 font-size: 1.05rem;
 font-weight: 700;
}
.studio-title span {
 font-size: 0.75rem;
 color: #94a3b8;
}
.btn-close {
 background: rgba(255, 255, 255, 0.1);
 border: 1px solid rgba(255, 255, 255, 0.15);
 color: #fff;
 padding: 8px 14px;
 border-radius: 8px;
 font-size: 0.8rem;
 font-weight: 700;
 cursor: pointer;
 flex-shrink: 0;
}
.btn-close:hover {
 background: #f43f5e;
 border-color: #f43f5e;
}
.studio-layout {
 display: flex;
 flex: 1;
 overflow: hidden;
 min-height: 0;
}
.studio-main {
 flex: 1;
 padding: 16px;
 overflow-y: auto;
 background-color: #121212;
 position: relative;
}
.studio-sidebar {
 width: 350px;
 background-color: #252525;
 border-left: 1px solid #444;
 padding: 16px;
 overflow-y: auto;
 flex-shrink: 0;
}
.form-label {
 margin-bottom: 5px;
 display: block;
 font-size: 0.85em;
 color: #aaa;
 font-weight: bold;
}

.dropzone {
 border: 2px dashed #444;
 border-radius: 10px;
 padding: 24px 16px;
 text-align: center;
 color: #888;
 background-color: rgba(255, 255, 255, 0.02);
 margin-bottom: 18px;
 transition: all 0.2s;
 cursor: pointer;
}
.dropzone.drag-active {
 border-color: #0ea5e9;
 background-color: rgba(14, 165, 233, 0.1);
 color: #0ea5e9;
 transform: scale(1.01);
}

.grid-view {
 display: grid;
 grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
 gap: 12px;
}
.media-card {
 background-color: #252525;
 border-radius: 8px;
 overflow: hidden;
 cursor: pointer;
 position: relative;
 border: 2px solid transparent;
 transition: transform 0.1s, border-color 0.2s;
 user-select: none;
}
.media-card.selected {
 border-color: #0ea5e9;
 box-shadow: 0 0 10px rgba(14, 165, 233, 0.3);
}
.media-card img,
.media-card video {
 width: 100%;
 height: 135px;
 object-fit: cover;
 display: block;
}
.status-badge {
 position: absolute;
 top: 8px;
 right: 8px;
 width: 14px;
 height: 14px;
 border-radius: 50%;
 border: 2px solid #252525;
 box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
 transition: background-color 0.3s;
}
.card-filename {
 font-size: 0.75rem;
 color: #a0a0a0;
 padding: 6px 8px;
 white-space: nowrap;
 overflow: hidden;
 text-overflow: ellipsis;
 background: #252525;
}

@keyframes pasteFlash {
 0% { background-color: transparent; }
 50% { background-color: #10b981; }
 100% { background-color: transparent; }
}
.flash-success::after {
 content: '';
 position: absolute;
 inset: 0;
 background-color: rgba(16, 185, 129, 0.4);
 animation: pasteFlash 0.5s ease-out;
 pointer-events: none;
}

.split-layout {
 display: flex;
 gap: 16px;
 height: calc(100dvh - 140px);
 margin-top: 12px;
}
.viewer-left {
 flex: 2;
 background: #000;
 border-radius: 8px;
 overflow: hidden;
 position: relative;
 display: flex;
 align-items: center;
 justify-content: center;
 min-height: 220px;
}
.viewer-right {
 flex: 1;
 display: flex;
 flex-direction: column;
 gap: 10px;
}
.viewer-right textarea {
 flex: 1;
 min-height: 140px;
 background: #252525;
 color: #f5f5f5;
 border: 1px solid #444;
 border-radius: 8px;
 padding: 14px;
 resize: none;
 outline: none;
}
.btn-retour-grille {
 background: transparent;
 border: 1px solid #444;
 color: #f5f5f5;
 padding: 8px 15px;
 border-radius: 6px;
 cursor: pointer;
 margin-bottom: 10px;
 display: inline-block;
 width: max-content;
}
.btn-retour-grille:hover {
 background: #333;
}

.magnifier-container {
 position: relative;
 width: 100%;
 height: 100%;
 display: flex;
 align-items: center;
 justify-content: center;
 overflow: hidden;
 cursor: crosshair;
}
.magnifier-container img {
 max-width: 100%;
 max-height: 100%;
 object-fit: contain;
}
#magnifier-lens {
 position: absolute;
 width: 180px;
 height: 180px;
 border-radius: 50%;
 border: 3px solid #0ea5e9;
 box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
 display: none;
 background-repeat: no-repeat;
 pointer-events: none;
 z-index: 10;
}

.sidebar-preview {
 margin-bottom: 16px;
 border-radius: 6px;
 overflow: hidden;
 border: 1px solid #444;
 background: #1e1e1e;
 text-align: center;
}
#preview-image {
 width: 100%;
 height: 160px;
 object-fit: contain;
 background-color: #000;
}
.preview-filename {
 padding: 8px;
 font-size: 0.8rem;
 color: #0ea5e9;
 background: #252525;
 word-break: break-all;
}
.btn-open-viewer {
 width: 100%;
 padding: 10px;
 background: #0ea5e9;
 color: white;
 border: none;
 cursor: pointer;
 font-weight: bold;
 border-radius: 0 0 6px 6px;
}
.btn-open-viewer:hover {
 background: #0284c7;
}

/* Autocomplétion */
.autocomplete-group {
 position: relative;
 display: flex;
 flex-direction: column;
 gap: 5px;
}
.input-wrapper {
 position: relative;
}
.form-input {
 width: 100%;
 padding: 10px 12px;
 background-color: #333;
 border: 1px solid #555;
 color: #f5f5f5;
 border-radius: 6px;
 outline: none;
}
.form-input:focus {
 border-color: #0ea5e9;
}
.suggestions-dropdown {
 position: absolute;
 top: 100%;
 left: 0;
 right: 0;
 background-color: #2a2a2a;
 border: 1px solid #444;
 border-radius: 0 0 6px 6px;
 max-height: 180px;
 overflow-y: auto;
 z-index: 100;
 padding: 0;
 margin: 0;
 list-style: none;
 box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}
.suggestion-item {
 padding: 10px 12px;
 cursor: pointer;
 border-bottom: 1px solid #333;
}
.suggestion-item:hover {
 background-color: #0ea5e9;
 color: white;
}
.suggestion-add {
 color: #10b981;
 font-style: italic;
}
.suggestion-add:hover {
 background-color: #10b981;
 color: white;
}

.tags-container {
 display: flex;
 flex-wrap: wrap;
 gap: 8px;
 margin-top: 5px;
}
.tag-badge {
 background-color: rgba(14, 165, 233, 0.2);
 border: 1px solid #0ea5e9;
 color: #0ea5e9;
 padding: 4px 10px;
 border-radius: 15px;
 font-size: 0.85em;
 display: flex;
 gap: 6px;
 align-items: center;
}
.tag-remove {
 cursor: pointer;
 font-weight: bold;
}
.tag-remove:hover {
 color: #f43f5e;
}

/* ========================================================= */
/* 6. SYSTÈME DE NOTIFICATIONS (TOASTS) */
/* ========================================================= */
#toast-container {
 position: fixed;
 bottom: 20px;
 left: 50%;
 transform: translateX(-50%);
 width: calc(100% - 24px);
 max-width: 420px;
 display: flex;
 flex-direction: column-reverse;
 align-items: center;
 gap: 10px;
 z-index: 10000;
 pointer-events: none;
}
.toast {
 width: auto;
 max-width: 100%;
 padding: 12px 18px;
 border-radius: 10px;
 background: rgba(30, 30, 30, 0.94);
 -webkit-backdrop-filter: blur(12px);
 backdrop-filter: blur(12px);
 border: 1px solid rgba(255, 255, 255, 0.14);
 color: #fff;
 display: flex;
 align-items: center;
 gap: 10px;
 animation: toastSlideUp 0.3s ease-out forwards;
 font-size: 0.875rem;
 box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
 pointer-events: auto;
 word-break: break-word;
}
.toast.info { border-left: 4px solid #0ea5e9; }
.toast.success { border-left: 4px solid #10b981; }
.toast.warning { border-left: 4px solid #f59e0b; }
.toast.error { border-left: 4px solid #f43f5e; }

@keyframes toastSlideUp {
 from { opacity: 0; transform: translateY(30px) scale(0.95); }
 to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastFadeOut {
 from { opacity: 1; transform: translateY(0) scale(1); }
 to { opacity: 0; transform: translateY(-15px) scale(0.95); }
}

/* ========================================================= */
/* 7. MODULE IMPRESSION (PRINT AGIPA & ORGANISATIONS) */
/* ========================================================= */
@media print {
 html,
 body {
 height: auto !important;
 overflow: visible !important;
 min-width: 0 !important;
 }
 body * {
 visibility: hidden;
 }
 #print-zone,
 #print-zone * {
 visibility: visible;
 }
 #print-zone {
 position: absolute;
 left: 0;
 top: 0;
 width: var(--print-pw);
 height: var(--print-ph);
 padding: var(--print-mt) var(--print-mr) var(--print-mb) var(--print-ml);
 background: white !important;
 display: grid !important;
 margin: 0;
 grid-template-columns: repeat(auto-fill, var(--print-lw));
 grid-auto-rows: var(--print-lh);
 gap: var(--print-gy) var(--print-gx);
 }
 .label-item {
 width: var(--print-lw);
 height: var(--print-lh);
 border: 1px dashed #ccc;
 box-sizing: border-box;
 overflow: hidden;
 padding: 3mm;
 color: black !important;
 font-family: sans-serif;
 display: flex;
 flex-direction: column;
 }
 #cover-page,
 #app-wrapper,
 #member-modal,
 #confirm-delete-modal,
 #form-member-modal,
 #photo-modal,
 #import-studio,
 #box-style-modal,
 #box-star-modal,
 #create-box-modal,
 #share-postcard-modal,
 #toast-container {
 display: none !important;
 }
 body.printing-org #print-zone {
 display: none !important;
 }
 body.printing-org #org-print-zone,
 body.printing-org #org-print-zone * {
 visibility: visible !important;
 }
 body.printing-org #org-print-zone {
 display: block !important;
 position: absolute;
 left: 0;
 top: 0;
 width: 100%;
 background: #ffffff !important;
 color: #111111 !important;
 }
 body.printing-member #print-zone,
 body.printing-member #org-print-zone {
 display: none !important;
 }
 body.printing-member #member-print-zone,
 body.printing-member #member-print-zone * {
 visibility: visible !important;
 }
 body.printing-member #member-print-zone {
 display: block !important;
 position: absolute;
 left: 0;
 top: 0;
 width: 100%;
 background: #ffffff !important;
 color: #0f172a !important;
 }
 #astro-zoom-modal,
 #member-compare-modal,
 #member-export-modal,
 #sidebar-photo-picker-modal {
 display: none !important;
 }
}

/* ========================================================= */
/* 8. MÉDIATHÈQUE : BOÎTES 3D COMPACTES (÷2) & 4 MODÈLES */
/* ========================================================= */
.fs-mediatheque-void {
 background: radial-gradient(circle at 50% 25%, #111218 0%, #050507 65%, #020203 100%);
 min-height: 100%;
 border-radius: 1.5rem;
 padding: 1rem;
}

/* Mode 1 : Boîtes 3D compactes (taille ÷2 pour afficher 6 à 8 boîtes/ligne) */
#vault-grid.vault-mode-3d {
 display: grid;
 grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
 gap: 1.35rem 0.75rem;
 justify-items: center;
}

/* Étagères thématiques repliables */
#vault-grid.vault-mode-3d.is-grouped-shelves {
 display: flex;
 flex-direction: column;
 gap: 1.25rem;
 align-items: stretch;
}
.fs-shelf-grid {
 display: grid;
 grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
 gap: 1.25rem 0.75rem;
 justify-items: center;
}

/* Mode 2 : Grille compacte de fiches boîtes */
#vault-grid.vault-mode-compact {
 display: grid;
 grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
 gap: 0.9rem;
 justify-items: stretch;
 align-items: stretch;
}

/* Mode 3 : Vue Liste / Tableau détaillé */
#vault-grid.vault-mode-list {
 display: flex;
 flex-direction: column;
 gap: 0.6rem;
 width: 100%;
}

/* Mode 4 : Galerie directe des photos / archives */
#vault-grid.vault-mode-gallery {
 display: grid;
 grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
 gap: 0.85rem;
 justify-items: stretch;
 align-items: stretch;
}

/* Boutons sélecteur de mode Médiathèque */
.vault-mode-btn {
 display: inline-flex;
 align-items: center;
 gap: 6px;
 padding: 6px 10px;
 border-radius: 10px;
 font-size: 11px;
 font-weight: 700;
 color: #94a3b8;
 background: transparent;
 border: 1px solid transparent;
 cursor: pointer;
 transition: all 0.16s ease;
 white-space: nowrap;
}
.vault-mode-btn:hover {
 color: #ffffff;
 background: rgba(255, 255, 255, 0.08);
}
.vault-mode-btn.is-active {
 color: #000000;
 background: #f59e0b;
 border-color: #fbbf24;
 box-shadow: 0 0 14px rgba(245, 158, 11, 0.35);
}

/* Carte conteneur de chaque mini-boîte 3D */
.fs-box-item {
 display: flex;
 flex-direction: column;
 align-items: center;
 justify-content: flex-end;
 position: relative;
 user-select: none;
 width: 100%;
 max-width: 156px;
 padding: 6px 4px 8px;
 border-radius: 14px;
 border: 1px solid transparent;
 transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease, background-color 0.2s ease, border-color 0.2s ease;
}

/* Hover-Zoom 3D Loupe de Survol */
#vault-grid.vault-mode-3d:hover .fs-box-item:not(:hover):not(.is-selected-box) {
 opacity: 0.74;
}
.fs-box-item:hover {
 z-index: 30;
 background: rgba(255, 255, 255, 0.03);
 border-color: rgba(251, 191, 36, 0.28);
}
.fs-box-item:hover .fs-box-stage {
 transform: scale(1.18) translateY(-4px);
}
.fs-box-item.is-selected-box {
 background: rgba(14, 165, 233, 0.14);
 border-color: rgba(56, 189, 248, 0.75);
 box-shadow: 0 0 20px rgba(14, 165, 233, 0.28);
}

/* Case de sélection multiple */
.fs-box-select-check {
 position: absolute;
 top: 4px;
 right: 4px;
 z-index: 25;
 width: 18px;
 height: 18px;
 border-radius: 6px;
 border: 1px solid rgba(255, 255, 255, 0.28);
 background: rgba(15, 23, 42, 0.8);
 color: transparent;
 font-size: 9px;
 display: flex;
 align-items: center;
 justify-content: center;
 opacity: 0;
 transition: opacity 0.16s ease, background-color 0.16s ease;
 cursor: pointer;
}
.fs-box-item:hover .fs-box-select-check,
.fs-box-item.is-selected-box .fs-box-select-check {
 opacity: 1;
}
.fs-box-item.is-selected-box .fs-box-select-check {
 background: #0ea5e9;
 border-color: #38bdf8;
 color: #ffffff;
}

/* Badges & Stickers collectifs en haut à gauche */
.fs-box-top-badges {
 position: absolute;
 top: 4px;
 left: 4px;
 z-index: 22;
 display: flex;
 flex-direction: column;
 gap: 3px;
 pointer-events: auto;
}
.fs-sticker-pill {
 display: inline-flex;
 align-items: center;
 gap: 2px;
 padding: 1px 5px;
 border-radius: 999px;
 font-size: 9px;
 font-weight: 800;
 background: rgba(9, 9, 13, 0.84);
 border: 1px solid rgba(255, 255, 255, 0.18);
 color: #fde68a;
 -webkit-backdrop-filter: blur(4px);
 backdrop-filter: blur(4px);
 cursor: pointer;
 transition: transform 0.15s ease;
}
.fs-sticker-pill:hover {
 transform: scale(1.14);
}

/* Halos lumineux (÷2) */
.fs-souvenir-halo,
.fs-investigation-halo {
 position: absolute;
 width: 112px;
 height: 112px;
 top: 14px;
 border-radius: 9999px;
 filter: blur(7px);
 animation: fsHaloPulse 3.6s ease-in-out infinite alternate;
 pointer-events: none;
 z-index: 0;
}
.fs-souvenir-halo {
 background: radial-gradient(circle, rgba(251, 191, 36, 0.28) 0%, rgba(245, 158, 11, 0.08) 45%, transparent 72%);
}
.fs-investigation-halo {
 background: radial-gradient(circle, rgba(34, 211, 238, 0.26) 0%, rgba(14, 165, 233, 0.08) 45%, transparent 72%);
}
@keyframes fsHaloPulse {
 0% { transform: scale(0.94); opacity: 0.65; }
 100% { transform: scale(1.08); opacity: 1; }
}

/* Scène et cube 3D compact (÷2 : 122px × 132px) */
.fs-box-stage {
 width: 122px;
 height: 132px;
 perspective: 720px;
 display: flex;
 align-items: center;
 justify-content: center;
 position: relative;
 z-index: 10;
 cursor: grab;
 touch-action: none;
 transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
.fs-box-stage:active {
 cursor: grabbing;
}

.fs-box-3d {
 width: 84px;
 height: 94px;
 position: relative;
 transform-style: preserve-3d;
 transition: transform 0.12s ease-out;
}
.fs-box-3d.is-animating {
 transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Mode Manège / Carrousel 360° */
@keyframes fsCarouselSpin {
 from { transform: rotateX(-12deg) rotateY(0deg); }
 to { transform: rotateX(-12deg) rotateY(360deg); }
}
.fs-box-3d.is-carousel {
 animation: fsCarouselSpin 9s linear infinite;
}

/* Secousse magique ("Shake pour Mélanger") */
@keyframes fsBoxMagicShake {
 0%, 100% { transform: rotateX(-11deg) rotateY(-26deg) translateX(0); }
 20% { transform: rotateX(-14deg) rotateY(-34deg) translateX(-4px) rotateZ(-3deg); }
 40% { transform: rotateX(-8deg) rotateY(-18deg) translateX(4px) rotateZ(3deg); }
 60% { transform: rotateX(-13deg) rotateY(-31deg) translateX(-3px) rotateZ(-2deg); }
 80% { transform: rotateX(-9deg) rotateY(-21deg) translateX(3px) rotateZ(2deg); }
}
.fs-box-3d.is-shaking {
 animation: fsBoxMagicShake 0.45s ease-in-out;
}

.fs-box-shadow {
 width: 84px;
 height: 14px;
 background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.95) 0%, transparent 75%);
 margin-top: -6px;
 margin-bottom: 5px;
 pointer-events: none;
}

/* Faces communes du cube 3D compact (profondeur ±42px) */
.fs-face {
 position: absolute;
 inset: 0;
 backface-visibility: visible;
 border-radius: 4px;
 display: flex;
 flex-direction: column;
 align-items: center;
 justify-content: center;
 padding: 6px;
 transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease;
}

.fs-face-front { transform: rotateY(0deg) translateZ(42px); }
.fs-face-right { transform: rotateY(90deg) translateZ(42px); }
.fs-face-back { transform: rotateY(180deg) translateZ(42px); }
.fs-face-left { transform: rotateY(-90deg) translateZ(42px); }
.fs-face-top {
 width: 84px;
 height: 84px;
 top: 5px;
 transform: rotateX(90deg) translateZ(47px);
 cursor: pointer;
}
.fs-face-bottom {
 width: 84px;
 height: 84px;
 top: 5px;
 transform: rotateX(-90deg) translateZ(47px);
}

/* Ouverture en étoile (au double-clic) */
.fs-box-3d.star-open .fs-face-front { transform: rotateY(0deg) translateZ(42px) rotateX(-78deg) translateY(28px); }
.fs-box-3d.star-open .fs-face-right { transform: rotateY(90deg) translateZ(42px) rotateX(-78deg) translateY(28px); }
.fs-box-3d.star-open .fs-face-back { transform: rotateY(180deg) translateZ(42px) rotateX(-78deg) translateY(28px); }
.fs-box-3d.star-open .fs-face-left { transform: rotateY(-90deg) translateZ(42px) rotateX(-78deg) translateY(28px); }

/* Fente supérieure & Aimant à Souvenirs */
.fs-slot-opening {
 width: 58px;
 height: 12px;
 background: #09090b;
 border-radius: 3px;
 box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.95), 0 1px 0 rgba(255, 255, 255, 0.16);
 position: relative;
 display: flex;
 align-items: center;
 justify-content: center;
 transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.fs-face-top.is-live-slot .fs-slot-opening {
 box-shadow: inset 0 2px 6px #000, 0 0 10px rgba(52, 211, 153, 0.75);
}
.fs-face-top.slot-drag-hover .fs-slot-opening,
body.fs-file-dragging .fs-face-top .fs-slot-opening {
 transform: scale(1.15);
 box-shadow: inset 0 1px 4px #000, 0 0 14px rgba(251, 191, 36, 0.95);
 border: 1px solid #fbbf24;
}

/* Tirages photo dépassant de la fente du haut en éventail */
.fs-top-stack {
 position: absolute;
 top: -14px;
 left: 50%;
 transform: translateX(-50%) translateZ(12px);
 width: 48px;
 height: 28px;
 pointer-events: none;
}
.fs-fan-card {
 position: absolute;
 width: 36px;
 height: 25px;
 left: 6px;
 top: 0;
 background: #f8f7f4;
 padding: 2px 2px 4px;
 border-radius: 2px;
 box-shadow: 0 3px 8px rgba(0, 0, 0, 0.7);
 transition: transform 0.3s ease;
}
.fs-fan-card:nth-child(1) { transform: rotate(-10deg) translateX(-5px); }
.fs-fan-card:nth-child(2) { transform: rotate(2deg) translateY(-2px); }
.fs-fan-card:nth-child(3) { transform: rotate(12deg) translateX(5px); }
.fs-fan-card img {
 width: 100%;
 height: 100%;
 object-fit: cover;
}

/* ========================================================= */
/* MODÈLE 1 : BOÎTE D'ARCHIVES (MALLE BLEUE & ONGLETS KRAFT) */
/* ========================================================= */
.box-style-archives .fs-face {
 background: linear-gradient(145deg, #2d7a89 0%, #1e5b68 55%, #133f49 100%);
 border: 1px solid rgba(103, 232, 249, 0.32);
 box-shadow: inset 0 0 14px rgba(6, 24, 30, 0.65);
}
.fs-archive-corner {
 position: absolute;
 width: 12px;
 height: 12px;
 background: linear-gradient(135deg, #8c6a4a, #4d3724);
 border: 1px solid rgba(253, 230, 138, 0.35);
 pointer-events: none;
}
.fs-archive-corner.tl { top: 0; left: 0; border-radius: 3px 0 6px 0; }
.fs-archive-corner.tr { top: 0; right: 0; border-radius: 0 3px 0 6px; }
.fs-archive-corner.bl { bottom: 0; left: 0; border-radius: 0 6px 0 3px; }
.fs-archive-corner.br { bottom: 0; right: 0; border-radius: 6px 0 3px 0; }

.fs-archive-emblem {
 width: 46px;
 height: 46px;
 border-radius: 9999px;
 background: radial-gradient(circle, #e8c78a 0%, #c89d54 75%, #997130 100%);
 border: 1.5px solid #fef3c7;
 color: #271a0c;
 display: flex;
 flex-direction: column;
 align-items: center;
 justify-content: center;
 text-align: center;
 padding: 2px;
 box-shadow: 0 3px 8px rgba(0, 0, 0, 0.55);
}
.fs-archive-sticker {
 position: absolute;
 font-size: 5.5px;
 font-weight: 900;
 padding: 1px 4px;
 border-radius: 3px;
 text-transform: uppercase;
 box-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}
.fs-archive-tabs-stack {
 position: absolute;
 top: -15px;
 left: 50%;
 transform: translateX(-50%) translateZ(10px);
 width: 68px;
 height: 24px;
 display: flex;
 flex-direction: column;
 gap: 2px;
 align-items: center;
}
.fs-kraft-tab {
 width: 100%;
 height: 11px;
 background: linear-gradient(180deg, #e5c69b 0%, #cca470 100%);
 border: 1px solid #8c6239;
 border-radius: 3px 3px 0 0;
 color: #3b230e;
 font-family: monospace;
 font-size: 6.5px;
 font-weight: 900;
 display: flex;
 align-items: center;
 justify-content: center;
 box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.45);
 cursor: pointer;
 transition: transform 0.15s ease, background 0.15s ease;
}
.fs-kraft-tab:hover {
 transform: translateY(-3px) scale(1.06);
 background: #fde68a;
}

/* ========================================================= */
/* MODÈLE 2 : CUBE 3 (BOIS CLAIR, SOCLE TURQUOISE & PASTELS) */
/* ========================================================= */
.box-style-cube3 .fs-face {
 background: linear-gradient(145deg, #e4c398 0%, #cfa46e 55%, #b3834c 100%);
 border: 2px solid #966836;
 box-shadow: inset 0 0 12px rgba(74, 43, 15, 0.35);
}
.box-style-cube3 .fs-box-shadow {
 width: 76px;
 height: 11px;
 border-radius: 9999px;
 background: linear-gradient(180deg, #5eead4 0%, #14b8a6 60%, #0f766e 100%);
 box-shadow: 0 4px 10px rgba(0, 0, 0, 0.9);
 margin-top: -4px;
 margin-bottom: 6px;
}
.fs-cube3-border {
 position: relative;
 width: 62px;
 height: 62px;
 background: #f8f7f4;
 padding: 3px 3px 8px;
 border-radius: 2px;
 box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}
.fs-photo-corner {
 position: absolute;
 width: 10px;
 height: 10px;
 z-index: 5;
 pointer-events: none;
}
.fs-photo-corner.tl { top: -1px; left: -1px; background: linear-gradient(135deg, #fb7185 50%, transparent 50%); }
.fs-photo-corner.tr { top: -1px; right: -1px; background: linear-gradient(225deg, #facc15 50%, transparent 50%); }
.fs-photo-corner.bl { bottom: -1px; left: -1px; background: linear-gradient(45deg, #2dd4bf 50%, transparent 50%); }
.fs-photo-corner.br { bottom: -1px; right: -1px; background: linear-gradient(315deg, #fb923c 50%, transparent 50%); }

.fs-cube3-engraving {
 font-size: 6px;
 font-weight: 900;
 letter-spacing: 0.08em;
 text-transform: uppercase;
 color: #5c3818;
 margin-top: 3px;
}

/* ========================================================= */
/* MODÈLE 3 : SHADOW BOX (CADRE BLANC VITRÉ & DROP HERE !) */
/* ========================================================= */
.box-style-shadowbox .fs-face {
 background: linear-gradient(145deg, #f8fafc 0%, #e2e8f0 60%, #cbd5e1 100%);
 border: 2px solid #ffffff;
 box-shadow: inset 0 0 12px rgba(15, 23, 42, 0.25);
 color: #1e293b;
}
.box-style-shadowbox .fs-face-front {
 background: linear-gradient(160deg, rgba(255, 255, 255, 0.95) 0%, rgba(241, 245, 249, 0.9) 100%);
 padding: 4px;
}
.fs-shadowbox-glass {
 width: 100%;
 height: 100%;
 border: 3px solid #f8fafc;
 border-radius: 3px;
 background: #1e1b18;
 position: relative;
 overflow: hidden;
 box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.85);
 display: grid;
 grid-template-columns: repeat(2, 1fr);
 grid-template-rows: repeat(2, 1fr);
 gap: 2px;
 padding: 3px;
 transform-style: preserve-3d;
}
.fs-shadowbox-glass::after {
 content: '';
 position: absolute;
 inset: 0;
 background: linear-gradient(125deg, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0.04) 45%, transparent 60%);
 pointer-events: none;
 transform: translateZ(7px);
}
.fs-sb-mini-polaroid {
 background: #fff;
 padding: 1.5px 1.5px 4px;
 border-radius: 1px;
 box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
 transform: rotate(-4deg);
 overflow: hidden;
}
.fs-sb-mini-polaroid:nth-child(even) {
 transform: rotate(5deg);
}
.fs-sb-ticket {
 position: absolute;
 bottom: 4px;
 right: 4px;
 background: #f59e0b;
 color: #1c1917;
 font-family: monospace;
 font-size: 5.5px;
 font-weight: 900;
 padding: 1px 3px;
 border-radius: 1px;
 border: 0.5px dashed #451a03;
 transform: rotate(-7deg) translateZ(3px);
 z-index: 4;
 box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.fs-sb-header-script {
 font-family: var(--font-hand);
 font-size: 8.5px;
 font-weight: 700;
 color: #0f172a;
 line-height: 1;
 margin-bottom: 2px;
}
.fs-sb-drop-label {
 font-size: 5.5px;
 font-weight: 900;
 text-transform: uppercase;
 letter-spacing: 0.06em;
 color: #334155;
 margin-bottom: 2px;
}

/* ========================================================= */
/* MODÈLE 4 : L'ALLIANCE (BI-MATIÈRE CHÊNE & NOYER + LAITON) */
/* ========================================================= */
.box-style-alliance .fs-face {
 background: linear-gradient(90deg, #dfbe93 0%, #c69a63 49.5%, #5b3820 50.5%, #382010 100%);
 border: 1px solid rgba(251, 191, 36, 0.45);
 box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.45);
}

/* Vitre embuée interactive pour boîtes Privées / Verrouillées */
.fs-frost-glass {
 position: absolute;
 inset: 3px;
 z-index: 12;
 border-radius: 3px;
 background: radial-gradient(circle, rgba(226, 232, 240, 0.76) 0%, rgba(148, 163, 184, 0.88) 100%);
 -webkit-backdrop-filter: blur(5px);
 backdrop-filter: blur(5px);
 display: flex;
 flex-direction: column;
 align-items: center;
 justify-content: center;
 text-align: center;
 color: #0f172a;
 font-size: 6.5px;
 font-weight: 900;
 transition: opacity 0.45s ease;
 cursor: crosshair;
}
.fs-frost-glass.is-wiped {
 opacity: 0.06;
 pointer-events: none;
}

.fs-polaroid-frame {
 width: 58px;
 height: 54px;
 background: #f8f7f4;
 padding: 3px 3px 8px;
 border-radius: 2px;
 box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
 overflow: hidden;
}
.fs-ghost-frame {
 width: 100%;
 height: 100%;
 border: 1px dashed rgba(14, 165, 233, 0.6);
 background: rgba(15, 23, 42, 0.85);
 color: #7dd3fc;
 font-size: 6px;
 font-weight: 700;
 display: flex;
 flex-direction: column;
 align-items: center;
 justify-content: center;
 text-align: center;
 padding: 2px;
}
.fs-brand-engraving {
 margin-top: 4px;
 font-family: var(--font-heading);
 font-size: 6.5px;
 font-weight: 800;
 letter-spacing: 0.1em;
 text-transform: uppercase;
 color: rgba(255, 255, 255, 0.78);
 text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}
.fs-brass-latch {
 position: absolute;
 bottom: 4px;
 width: 14px;
 height: 6px;
 border-radius: 2px;
 background: linear-gradient(135deg, #fde68a, #b45309);
 border: 1px solid #fef3c7;
 box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.fs-brass-latch.is-locked {
 background: linear-gradient(135deg, #f43f5e, #9f1239);
 border-color: #fecdd3;
}
.fs-retro-back-card {
 width: 68px;
 height: 76px;
 background: #fdf6e3;
 border-radius: 3px;
 padding: 4px;
 display: flex;
 flex-direction: column;
 justify-content: space-between;
 text-align: center;
 box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
}
.fs-inserting-photo {
 position: absolute;
 width: 44px;
 height: 34px;
 top: -12px;
 left: 50%;
 transform: translateX(-50%);
 border: 2px solid #fff;
 border-radius: 2px;
 overflow: hidden;
 z-index: 40;
 animation: fsInsertSlot 0.68s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes fsInsertSlot {
 0% { transform: translate(-50%, -18px) scale(1.1); opacity: 1; }
 100% { transform: translate(-50%, 24px) scale(0.4); opacity: 0; }
}
.fs-musicbox-spin {
 animation: fsOrbitRotate 22s linear infinite;
}
@keyframes fsOrbitRotate {
 from { transform: rotate(0deg); }
 to { transform: rotate(360deg); }
}

/* ========================================================= */
/* 9. BARRE DE RÉACTIONS (LIKE + ÉMOTICÔNES) & PARTAGE */
/* ========================================================= */
.fs-reaction-pill {
 display: inline-flex;
 align-items: center;
 gap: 4px;
 padding: 4px 9px;
 border-radius: 9999px;
 font-size: 11px;
 font-weight: 700;
 background: rgba(255, 255, 255, 0.06);
 border: 1px solid rgba(255, 255, 255, 0.12);
 color: #e2e8f0;
 cursor: pointer;
 transition: all 0.16s ease;
 user-select: none;
}
.fs-reaction-pill:hover {
 background: rgba(255, 255, 255, 0.14);
 transform: translateY(-1px);
}
.fs-reaction-pill.is-active {
 background: rgba(14, 165, 233, 0.22);
 border-color: var(--color-primary);
 color: #ffffff;
 box-shadow: 0 0 12px var(--color-primary-glow);
}
.fs-reaction-pill.is-heart-active {
 background: rgba(244, 63, 94, 0.22);
 border-color: #f43f5e;
 color: #fecdd3;
}

/* ========================================================= */
/* 10. ADAPTATIONS SMARTPHONE & TABLETTE (MAX-WIDTH: 767PX) */
/* ========================================================= */
@media (max-width: 767px) {
 html,
 body {
 height: 100dvh;
 }

 /* Drawer mobile garanti même sans Tailwind CDN */
 #sidebar {
 position: fixed;
 top: 0;
 bottom: 0;
 left: 0;
 width: 270px;
 z-index: 60;
 transform: translateX(-100%);
 transition: transform 0.28s ease-out;
 }
 #sidebar.fs-sidebar-open {
 transform: translateX(0) !important;
 }
 #mobile-sidebar-backdrop.fs-backdrop-open {
 display: block !important;
 position: fixed;
 inset: 0;
 background: rgba(0, 0, 0, 0.72);
 z-index: 55;
 }

 .fs-mediatheque-void {
 padding: 0.75rem;
 border-radius: 1rem;
 }

 .fs-box-stage {
 width: 112px;
 height: 122px;
 }

 .fs-box-3d {
 transform-origin: center center;
 }

 /* Studio d'importation empilé sur mobile */
 .studio-layout {
 flex-direction: column;
 overflow-y: auto;
 }
 .studio-main {
 flex: none;
 min-height: 45vh;
 }
 .studio-sidebar {
 width: 100%;
 border-left: none;
 border-top: 1px solid #444;
 flex: none;
 }
 .split-layout {
 flex-direction: column;
 height: auto;
 }
 .viewer-left {
 min-height: 220px;
 max-height: 40vh;
 }

 /* Zone d'interaction tactile plus confortable */
 .mm-move-btn,
 .mm-move-btn-dark {
 width: 32px;
 height: 32px;
 }
}

@media (min-width: 768px) {
 .fs-mobile-menu-btn,
 .fs-mobile-close-btn {
 display: none !important;
 }
 #sidebar {
 position: static;
 transform: none !important;
 }
}

/* ========================================================= */
/* 11. MODE INVITÉ EXTÉRIEUR CLOISONNÉ ("VUE CLIENT") */
/* ========================================================= */
body.fs-guest-mode #sidebar,
body.fs-guest-mode #mobile-sidebar-backdrop,
body.fs-guest-mode .fs-mobile-menu-btn {
 display: none !important;
}
body.fs-guest-mode #main-view {
 padding-top: 1rem !important;
 width: 100% !important;
}

/* ========================================================= */
/* 12. PAGE DE GARDE (LOGO ANIMÉ & CONNEXION) + LOGO SIDEBAR */
/* ========================================================= */
.fs-cover-page {
 background:
 radial-gradient(circle at 50% 20%, rgba(14, 165, 233, 0.16) 0%, transparent 52%),
 radial-gradient(circle at 80% 85%, rgba(139, 92, 246, 0.14) 0%, transparent 48%),
 #020617;
 transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.fs-cover-page.fs-cover-closing {
 opacity: 0;
 transform: scale(1.03);
 pointer-events: none;
}
.fs-cover-video-frame {
 aspect-ratio: 1 / 1;
 background: #000000;
}
.fs-cover-video-frame video {
 display: block;
 width: 100%;
 height: 100%;
 object-fit: cover;
}
.fs-cover-sound-btn {
 cursor: pointer;
}
.fs-sidebar-logo-wrap {
 aspect-ratio: 1 / 1;
 cursor: pointer;
 padding: 0;
 display: block;
}
.fs-sidebar-logo-wrap img {
 display: block;
 width: 100%;
 height: 100%;
 object-fit: cover;
}
/* Préserve l'écrin sombre de la page de garde même si le thème clair est actif */
.theme-light .fs-cover-page {
 background:
 radial-gradient(circle at 50% 20%, rgba(14, 165, 233, 0.2) 0%, transparent 55%),
 #020617 !important;
}
.theme-light .fs-cover-page .text-white {
 color: #f8fafc !important;
}
.theme-light .fs-cover-page .text-slate-300 {
 color: #cbd5e1 !important;
}
.theme-light .fs-cover-page .text-slate-400 {
 color: #94a3b8 !important;
}
.theme-light .fs-cover-page .glass-panel {
 background: rgba(15, 23, 42, 0.86) !important;
 border-color: rgba(255, 255, 255, 0.14) !important;
}
.theme-light .fs-cover-page .input-glass {
 background: rgba(2, 6, 23, 0.72) !important;
 color: #f8fafc !important;
 border-color: rgba(255, 255, 255, 0.16) !important;
}

/* ========================================================= */
/* 13. OPTIMISATIONS FLUIDITÉ, GPU & ACCESSIBILITÉ */
/* ========================================================= */
.fs-box-item {
 contain: layout style;
}
.fs-box-3d {
 will-change: transform;
}
.timeline-item {
 contain: layout style;
 will-change: transform, opacity;
}
#sidebar {
 will-change: transform;
}
#vault-grid.vault-mode-gallery > div,
#vault-grid.vault-mode-compact > div,
#vault-grid.vault-mode-list > div {
 content-visibility: auto;
 contain-intrinsic-size: 260px;
}
#family-grid > div {
 content-visibility: auto;
 contain-intrinsic-size: 320px;
}
/* Focus clavier visible pour l'ergonomie */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
 outline: 2px solid var(--color-primary);
 outline-offset: 2px;
}
/* Respect des préférences système d'animations réduites */
@media (prefers-reduced-motion: reduce) {
 .theme-blobs::before,
 .theme-blobs::after,
 .fs-box-3d.is-carousel,
 .fs-souvenir-halo,
 .fs-investigation-halo,
 .fs-musicbox-spin {
 animation: none !important;
 }
}

/* ========================================================= */
/* 14. ARBRE GÉNÉALOGIQUE 3D IMMERSIF (ORGANIGRAMME + CASCADE)*/
/* ========================================================= */
.fs-tree3d-shell {
 background:
 radial-gradient(circle at 50% 18%, rgba(14, 165, 233, 0.14) 0%, transparent 52%),
 radial-gradient(circle at 80% 85%, rgba(139, 92, 246, 0.12) 0%, transparent 48%),
 #040711;
}

.fs-tree3d-viewport {
 perspective: 1400px;
 perspective-origin: 50% 32%;
 position: relative;
}

.fs-tree3d-stage {
 position: relative;
 min-width: 100%;
 min-height: 100%;
 padding: 2.25rem 2.5rem 4rem;
 display: flex;
 justify-content: center;
 align-items: flex-start;
 transform-style: preserve-3d;
}

/* Grille 3D lumineuse subtile en arrière-plan */
.fs-tree3d-floor {
 position: absolute;
 inset: 0;
 pointer-events: none;
 opacity: 0;
 background-image:
 linear-gradient(rgba(56, 189, 248, 0.08) 1px, transparent 1px),
 linear-gradient(90deg, rgba(56, 189, 248, 0.08) 1px, transparent 1px);
 background-size: 46px 46px;
 mask-image: radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0.75) 0%, transparent 72%);
 transition: opacity 0.4s ease;
 z-index: 0;
}
.fs-tree3d-stage.is-3d-active .fs-tree3d-floor {
 opacity: 1;
}

.fs-tree3d-scene {
 position: relative;
 z-index: 10;
 transform-origin: top center;
 transform-style: preserve-3d;
 transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
 will-change: transform;
}

/* --- MODE ORGANIGRAMME RELATIONNEL (OPTION 2 + REPLIABLE) --- */
.fs-tree3d-root-ul,
.fs-tree3d-ul {
 list-style: none;
 margin: 0;
 padding: 0;
 display: flex;
 justify-content: center;
 align-items: flex-start;
 transform-style: preserve-3d;
}

.fs-tree3d-root-ul {
 gap: 2.5rem;
}

.fs-tree3d-ul {
 padding-top: 26px;
 position: relative;
}

.fs-tree3d-ul::before {
 content: '';
 position: absolute;
 top: 0;
 left: 50%;
 width: 2px;
 height: 26px;
 background: linear-gradient(180deg, rgba(56, 189, 248, 0.8), rgba(148, 163, 184, 0.45));
 transform: translateX(-50%);
 box-shadow: 0 0 8px rgba(56, 189, 248, 0.45);
}

.fs-tree3d-li {
 position: relative;
 display: flex;
 flex-direction: column;
 align-items: center;
 padding: 26px 12px 0;
 transform-style: preserve-3d;
}

.fs-tree3d-root-ul > .fs-tree3d-li {
 padding-top: 0;
}

/* Connecteurs horizontaux et verticaux vers chaque enfant */
.fs-tree3d-ul > .fs-tree3d-li::before,
.fs-tree3d-ul > .fs-tree3d-li::after {
 content: '';
 position: absolute;
 top: 0;
 right: 50%;
 width: 50%;
 height: 26px;
 border-top: 2px solid rgba(56, 189, 248, 0.5);
 pointer-events: none;
}

.fs-tree3d-ul > .fs-tree3d-li::after {
 right: auto;
 left: 50%;
 border-left: 2px solid rgba(56, 189, 248, 0.55);
}

.fs-tree3d-ul > .fs-tree3d-li:only-child::before,
.fs-tree3d-ul > .fs-tree3d-li:only-child::after {
 display: none;
}
.fs-tree3d-ul > .fs-tree3d-li:only-child {
 padding-top: 0;
}

.fs-tree3d-ul > .fs-tree3d-li:first-child::before,
.fs-tree3d-ul > .fs-tree3d-li:last-child::after {
 border: 0 none;
}

.fs-tree3d-ul > .fs-tree3d-li:last-child::before {
 border-right: 2px solid rgba(56, 189, 248, 0.55);
 border-radius: 0 10px 0 0;
}

.fs-tree3d-ul > .fs-tree3d-li:first-child::after {
 border-radius: 10px 0 0 0;
}

/* --- MODE CASCADE VERTICALE REPLIABLE (OPTION 3) --- */
.fs-tree3d-root-ul.is-cascade,
.fs-tree3d-ul.is-cascade {
 flex-direction: column;
 align-items: flex-start;
 gap: 1rem;
 padding-top: 14px;
}

.fs-tree3d-ul.is-cascade {
 margin-left: 1.75rem;
 padding-left: 1.5rem;
 border-left: 2px solid rgba(56, 189, 248, 0.45);
}

.fs-tree3d-ul.is-cascade::before,
.fs-tree3d-ul.is-cascade > .fs-tree3d-li::before,
.fs-tree3d-ul.is-cascade > .fs-tree3d-li::after {
 display: none !important;
}

.fs-tree3d-root-ul.is-cascade .fs-tree3d-li {
 align-items: flex-start;
 padding: 0;
}

.fs-tree3d-ul.is-cascade > .fs-tree3d-li::before {
 display: block !important;
 content: '';
 position: absolute;
 left: -1.5rem;
 top: 28px;
 width: 1.5rem;
 height: 2px;
 border: none;
 background: rgba(56, 189, 248, 0.5);
}

/* --- CONTENEUR DE NŒUD & PROFONDEUR 3D --- */
.fs-tree3d-node-wrap {
 position: relative;
 display: flex;
 flex-direction: column;
 align-items: center;
 gap: 6px;
 transform-style: preserve-3d;
 transition: transform 0.3s ease;
}

.fs-tree3d-stage.is-3d-active .fs-tree3d-node-wrap {
 transform: translateZ(calc((4 - var(--depth, 0)) * 10px));
}

.fs-tree3d-gen-tag {
 font-size: 9px;
 font-family: monospace;
 font-weight: 800;
 text-transform: uppercase;
 letter-spacing: 0.08em;
 color: rgba(148, 163, 184, 0.85);
 background: rgba(15, 23, 42, 0.85);
 border: 1px solid rgba(255, 255, 255, 0.1);
 padding: 1px 8px;
 border-radius: 999px;
}

.fs-tree3d-couple {
 display: inline-flex;
 align-items: center;
 gap: 6px;
 padding: 6px;
 border-radius: 18px;
 background: rgba(15, 23, 42, 0.62);
 border: 1px solid rgba(255, 255, 255, 0.12);
 box-shadow:
 0 14px 32px rgba(0, 0, 0, 0.55),
 inset 0 1px 0 rgba(255, 255, 255, 0.12);
 -webkit-backdrop-filter: blur(10px);
 backdrop-filter: blur(10px);
 transform-style: preserve-3d;
 transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.fs-tree3d-couple.is-highlighted {
 border-color: #fbbf24 !important;
 box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.35), 0 18px 40px rgba(251, 191, 36, 0.25) !important;
}

.fs-tree3d-union-link {
 display: flex;
 flex-direction: column;
 align-items: center;
 justify-content: center;
 gap: 2px;
 padding: 4px 5px;
 border-radius: 10px;
 background: rgba(244, 63, 94, 0.14);
 border: 1px solid rgba(244, 63, 94, 0.32);
}

/* Carte Membre 3D Glassmorphism */
.fs-tree3d-card {
 width: 162px;
 padding: 9px 10px;
 border-radius: 14px;
 background: linear-gradient(160deg, rgba(15, 23, 42, 0.94) 0%, rgba(2, 6, 23, 0.96) 100%);
 border: 1px solid rgba(255, 255, 255, 0.12);
 border-left: 3.5px solid var(--branch-color, #38bdf8);
 box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
 cursor: pointer;
 display: flex;
 flex-direction: column;
 gap: 7px;
 transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.24s ease, border-color 0.24s ease;
}

.fs-tree3d-card:hover {
 transform: translateY(-4px) translateZ(24px) scale(1.04);
 border-color: var(--branch-color, #38bdf8);
 box-shadow: 0 16px 32px rgba(0, 0, 0, 0.65), 0 0 20px var(--branch-glow, rgba(56, 189, 248, 0.35));
 z-index: 25;
}

.fs-tree3d-card.is-deceased {
 border-left-color: #64748b;
 opacity: 0.9;
}

.fs-tree3d-card-top {
 display: flex;
 align-items: center;
 gap: 8px;
}

.fs-tree3d-avatar {
 width: 34px;
 height: 34px;
 border-radius: 10px;
 background: linear-gradient(135deg, #1e293b, #020617);
 border: 1.5px solid rgba(255, 255, 255, 0.16);
 color: #ffffff;
 font-family: var(--font-heading);
 font-weight: 900;
 font-size: 12px;
 display: flex;
 align-items: center;
 justify-content: center;
 position: relative;
 flex-shrink: 0;
}

.fs-tree3d-gender {
 position: absolute;
 bottom: -4px;
 right: -4px;
 width: 14px;
 height: 14px;
 border-radius: 999px;
 background: #0f172a;
 border: 1px solid rgba(255, 255, 255, 0.22);
 font-size: 8px;
 display: flex;
 align-items: center;
 justify-content: center;
}

.fs-tree3d-card-meta {
 display: flex;
 align-items: center;
 justify-content: space-between;
 gap: 4px;
 padding-top: 5px;
 border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Bouton Replier / Déplier sous chaque foyer */
.fs-tree3d-toggle {
 display: inline-flex;
 align-items: center;
 gap: 5px;
 padding: 3px 10px;
 border-radius: 999px;
 font-size: 10px;
 font-weight: 800;
 color: #e0f2fe;
 background: rgba(14, 165, 233, 0.22);
 border: 1px solid rgba(56, 189, 248, 0.45);
 cursor: pointer;
 transition: all 0.18s ease;
 box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}
.fs-tree3d-toggle:hover {
 background: #0ea5e9;
 color: #ffffff;
 transform: scale(1.06);
}
.fs-tree3d-toggle.is-collapsed {
 background: rgba(245, 158, 11, 0.22);
 border-color: rgba(251, 191, 36, 0.55);
 color: #fde68a;
}

/* Carte Passerelle (lien sans duplication entre 2 lignées) */
.fs-tree3d-bridge {
 padding: 9px 14px;
 border-radius: 14px;
 background: rgba(245, 158, 11, 0.12);
 border: 1px dashed rgba(251, 191, 36, 0.55);
 cursor: pointer;
 transition: transform 0.2s ease, background-color 0.2s ease;
}
.fs-tree3d-bridge:hover {
 background: rgba(245, 158, 11, 0.24);
 transform: translateY(-2px) scale(1.03);
}

/* Préserve l'écrin 3D sombre de l'arbre même si le thème clair est actif */
.theme-light .fs-tree3d-shell .text-white { color: #f8fafc !important; }
.theme-light .fs-tree3d-shell .text-slate-200 { color: #e2e8f0 !important; }
.theme-light .fs-tree3d-shell .text-slate-300 { color: #cbd5e1 !important; }
.theme-light .fs-tree3d-shell .text-slate-400 { color: #94a3b8 !important; }

@media (prefers-reduced-motion: reduce) {
 .fs-tree3d-scene,
 .fs-tree3d-card {
 transition: none !important;
 }
}
/* ========================================================================= */
/* 15. CENTRE D'IMPORTATION, PRÉ-TAG & SAS « À RANGER » */
/* ========================================================================= */
.ic-dropzone {
 border: 2px dashed rgba(56, 189, 248, 0.35);
 border-radius: 1rem;
 padding: 1.15rem 1.25rem;
 background: rgba(14, 165, 233, 0.05);
 cursor: pointer;
 transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.ic-dropzone:hover,
.ic-dropzone.drag-active {
 border-color: var(--color-primary);
 background: rgba(14, 165, 233, 0.14);
 transform: scale(1.005);
}

.ic-queue-card .status-badge {
 position: absolute;
 top: 8px;
 right: 8px;
 width: 12px;
 height: 12px;
 border-radius: 999px;
 border: 2px solid #020617;
 box-shadow: 0 2px 6px rgba(0, 0, 0, 0.65);
}

#ic-magnifier-container {
 position: relative;
 width: 100%;
 height: 100%;
 display: flex;
 justify-content: center;
 align-items: center;
 cursor: crosshair;
}

#ic-viewer-img {
 max-width: 100%;
 max-height: 100%;
 object-fit: contain;
}

#ic-magnifier-lens {
 position: absolute;
 border: 3px solid var(--color-primary);
 border-radius: 50%;
 width: 180px;
 height: 180px;
 pointer-events: none;
 display: none;
 box-shadow: 0 10px 30px rgba(0, 0, 0, 0.85), inset 0 0 15px rgba(255, 255, 255, 0.2);
 background-repeat: no-repeat;
 z-index: 50;
}

.fs-unboxed-badge {
 animation: fsPulseAmber 2.4s ease-in-out infinite;
}

@keyframes fsPulseAmber {
 0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.45); }
 50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}
/* ========================================================================= */
/* 16. STUDIO CRÉATION FOND D'ÉCRAN IA (MAQUETTES & APERÇU CANVAS) */
/* ========================================================================= */
.wp-device-frame {
 position: relative;
 display: flex;
 align-items: center;
 justify-content: center;
 max-width: 100%;
 max-height: 100%;
 overflow: hidden;
 transition: all 0.3s ease;
}

.wp-device-frame.has-mockup.wp-kind-phone {
 border: 8px solid #1e293b;
 border-radius: 34px;
 box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 0 2px rgba(255, 255, 255, 0.14);
}

.wp-device-frame.has-mockup.wp-kind-tablet {
 border: 10px solid #1e293b;
 border-radius: 22px;
 box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 0 2px rgba(255, 255, 255, 0.14);
}

.wp-device-frame.has-mockup.wp-kind-desktop,
.wp-device-frame.has-mockup.wp-kind-tv {
 border: 7px solid #1e293b;
 border-radius: 14px;
 box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 0 2px rgba(255, 255, 255, 0.12);
}

.wp-preview-canvas {
 display: block;
 max-width: 100%;
 max-height: 62vh;
 width: auto;
 height: auto;
 object-fit: contain;
}

.wp-mockup-phone-overlay {
 position: absolute;
 inset: 0;
 display: flex;
 flex-direction: column;
 align-items: center;
 justify-content: space-between;
 padding: 10px 12px 8px;
 color: #ffffff;
 text-shadow: 0 2px 12px rgba(0, 0, 0, 0.75);
}

.wp-phone-notch {
 width: 32%;
 height: 14px;
 background: #020617;
 border-radius: 999px;
}

.wp-phone-clock {
 margin-top: 8px;
 text-align: center;
 margin-bottom: auto;
}

.wp-phone-homebar {
 width: 36%;
 height: 4px;
 background: rgba(255, 255, 255, 0.85);
 border-radius: 999px;
}

.wp-mockup-desktop-bar {
 position: absolute;
 left: 0;
 right: 0;
 bottom: 0;
 height: 22px;
 background: rgba(2, 6, 23, 0.78);
 -webkit-backdrop-filter: blur(8px);
 backdrop-filter: blur(8px);
 border-top: 1px solid rgba(255, 255, 255, 0.14);
 padding: 0 10px;
 display: flex;
 align-items: center;
 justify-content: space-between;
}
/* ========================================================================= */
/* 17. LABO & ENQUÊTEUR IA (CANVAS, PINCEAU MAGIQUE & ÉPINGLES D'INDICES) */
/* ========================================================================= */
.ai-photo-canvas {
 display: block;
 max-width: 100%;
 max-height: 60vh;
 width: auto;
 height: auto;
 border-radius: 14px;
 box-shadow: 0 20px 55px rgba(0, 0, 0, 0.78);
 border: 1px solid rgba(255, 255, 255, 0.14);
 touch-action: none;
}

.ai-photo-canvas.tool-compare { cursor: ew-resize; }
.ai-photo-canvas.tool-brush { cursor: crosshair; }
.ai-photo-canvas.tool-pin { cursor: copy; }

.ai-clue-pin {
 position: absolute;
 transform: translate(-50%, -50%);
 width: 24px;
 height: 24px;
 border-radius: 9999px;
 background: #10b981;
 color: #020617;
 font-size: 11px;
 font-weight: 900;
 border: 2px solid #ffffff;
 box-shadow: 0 4px 14px rgba(0, 0, 0, 0.75);
 display: flex;
 align-items: center;
 justify-content: center;
 cursor: pointer;
 transition: transform 0.16s ease, background-color 0.16s ease;
 z-index: 25;
}

.ai-clue-pin:hover,
.ai-clue-pin.is-active {
 transform: translate(-50%, -50%) scale(1.25);
 background: #f59e0b;
 color: #020617;
 box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.35), 0 6px 18px rgba(0, 0, 0, 0.85);
}
/* ========================================================================= */
/* 18. VIGNETTES FLIP-FLAP CORRESPONDANCES, PHOTO LATÉRALE & COMPARATEUR */
/* ========================================================================= */
.mm-cell.has-flip-matches {
 perspective: 900px;
 padding: 0 !important;
 background: transparent !important;
 border: none !important;
 overflow: visible !important;
 cursor: pointer;
}

.mm-flip-inner {
 position: relative;
 width: 100%;
 height: 100%;
 min-height: 54px;
 transform-style: preserve-3d;
 transition: transform 0.52s cubic-bezier(0.22, 1, 0.36, 1);
}

.mm-cell.has-flip-matches.is-flipped .mm-flip-inner {
 transform: rotateY(180deg);
}

.mm-flip-front,
.mm-flip-back {
 backface-visibility: hidden;
 -webkit-backface-visibility: hidden;
 width: 100%;
 height: 100%;
 border-radius: 0.75rem;
 padding: 0.5rem 0.75rem;
 display: flex;
 flex-direction: column;
 justify-content: space-between;
}

.mm-flip-front {
 position: relative;
}

.mm-flip-back {
 position: absolute;
 inset: 0;
 transform: rotateY(180deg);
 background: linear-gradient(145deg, rgba(15, 23, 42, 0.97) 0%, rgba(30, 41, 59, 0.97) 100%);
 border: 1px solid rgba(251, 191, 36, 0.55);
 box-shadow: 0 10px 26px rgba(0, 0, 0, 0.65);
 overflow-y: auto;
}

.mm-flip-badge {
 position: absolute;
 top: 5px;
 right: 6px;
 display: inline-flex;
 align-items: center;
 gap: 3px;
 padding: 1px 6px;
 border-radius: 999px;
 font-size: 9px;
 font-weight: 800;
 font-family: monospace;
 background: rgba(251, 191, 36, 0.18);
 border: 1px solid rgba(251, 191, 36, 0.45);
 color: #fde68a;
 z-index: 5;
 transition: transform 0.16s ease, background-color 0.16s ease;
}

.mm-cell.has-flip-matches:hover .mm-flip-badge {
 transform: scale(1.1);
 background: rgba(251, 191, 36, 0.32);
}

.mm-flip-member-chip {
 display: inline-flex;
 align-items: center;
 gap: 5px;
 padding: 2px 7px 2px 3px;
 border-radius: 999px;
 background: rgba(255, 255, 255, 0.08);
 border: 1px solid rgba(255, 255, 255, 0.16);
 color: #f8fafc;
 font-size: 10px;
 font-weight: 700;
 transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
 max-width: 100%;
}

.mm-flip-member-chip:hover {
 background: rgba(14, 165, 233, 0.28);
 border-color: #38bdf8;
 transform: translateY(-1px);
}

.mm-flip-avatar {
 width: 18px;
 height: 18px;
 border-radius: 999px;
 background: linear-gradient(135deg, #0ea5e9, #6366f1);
 color: #ffffff;
 font-size: 8px;
 font-weight: 900;
 display: inline-flex;
 align-items: center;
 justify-content: center;
 overflow: hidden;
 flex-shrink: 0;
}

.mm-flip-avatar img {
 width: 100%;
 height: 100%;
 object-fit: cover;
}

/* Slot photo personnalisable dans la barre latérale */
#mm-sidebar-photo-slot {
 transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
#mm-sidebar-photo-slot:hover {
 border-color: var(--color-primary);
 box-shadow: 0 0 22px var(--color-primary-glow);
}

/* Surlignage des différences / similitudes dans le comparateur */
.cmp-row-match {
 background: rgba(16, 185, 129, 0.09);
 border-color: rgba(16, 185, 129, 0.28) !important;
}
.cmp-row-diff {
 background: rgba(245, 158, 11, 0.06);
}

/* ========================================================================= */
/* 19. COMPATIBILITÉ IPHONE, IPAD, ANDROID & NAVIGATION INTUITIVE TACTILE */
/* ========================================================================= */
html,
body {
 height: 100dvh;
 overscroll-behavior-y: none;
}

.fs-mobile-menu-btn {
 top: calc(12px + env(safe-area-inset-top, 0px)) !important;
 left: calc(12px + env(safe-area-inset-left, 0px)) !important;
}

.fs-mobile-bottom-nav {
 padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
 padding-left: calc(4px + env(safe-area-inset-left, 0px));
 padding-right: calc(4px + env(safe-area-inset-right, 0px));
}

.fs-mnav-btn {
 flex: 1 1 0;
 min-width: 0;
 min-height: 46px;
 border-radius: 12px;
 background: transparent;
 border: 1px solid transparent;
 color: #94a3b8;
 display: flex;
 flex-direction: column;
 align-items: center;
 justify-content: center;
 gap: 3px;
 font-size: 10px;
 font-weight: 700;
 cursor: pointer;
 transition: all 0.16s ease;
}

.fs-mnav-btn i {
 font-size: 14px;
}

.fs-mnav-btn.is-active {
 color: var(--color-primary);
 background: rgba(14, 165, 233, 0.14);
 border-color: rgba(14, 165, 233, 0.35);
}

/* Écrans tactiles (iPhone, iPad, smartphones & tablettes sans survol souris) */
@media (hover: none), (pointer: coarse) {
 #mm-sidebar-photo-actions {
 opacity: 1 !important;
 }
 .fs-box-select-check {
 opacity: 1 !important;
 width: 22px;
 height: 22px;
 }
 .mm-move-btn,
 .mm-move-btn-dark {
 width: 34px;
 height: 34px;
 }
}

/* Neutralise le zoom automatique iOS Safari (< 16px) sur les champs de saisie */
@media (max-width: 1024px) {
 input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
 select,
 textarea {
 font-size: 16px !important;
 }
}

/* Tablettes (iPad & tablettes Android : 768px à 1180px) */
@media (min-width: 768px) and (max-width: 1180px) {
 #sidebar {
 width: 215px;
 }
 #member-modal > div {
 max-width: 98vw;
 max-height: 95dvh;
 }
 #mm-left-sidebar {
 width: 245px;
 }
 #mm-right-panel {
 flex: 1;
 }
 .mm-cell-fit {
 flex: 1 1 145px;
 }
}

/* Smartphones (iPhone & Android < 768px) : marges safe-area & ergonomie */
@media (max-width: 767px) {
 #main-view {
 padding-top: calc(56px + env(safe-area-inset-top, 0px)) !important;
 padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
 padding-left: calc(10px + env(safe-area-inset-left, 0px)) !important;
 padding-right: calc(10px + env(safe-area-inset-right, 0px)) !important;
 }
 #sidebar {
 padding-top: env(safe-area-inset-top, 0px);
 padding-bottom: env(safe-area-inset-bottom, 0px);
 }
 #member-modal {
 padding: calc(6px + env(safe-area-inset-top, 0px)) calc(6px + env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) calc(6px + env(safe-area-inset-left, 0px));
 }
 #member-modal > div {
 max-height: 96dvh;
 border-radius: 1.25rem;
 }
 .mm-cell-fit {
 flex: 1 1 140px;
 }
 .mm-cell-compact {
 flex: 1 1 100px;
 }
 .mm-flip-inner {
 min-height: 62px;
 }
}

body.fs-guest-mode #fs-mobile-bottom-nav {
 display: none !important;
}

/* ========================================================================= */
/* CORRECTIF GLOBAL FILTRES <select> / <option> (FOND SOMBRE LISIBLE)        */
/* ========================================================================= */
select {
 color-scheme: dark;
 background-color: #0f172a;
 color: #f8fafc;
}
select option,
select optgroup {
 background-color: #0f172a !important;
 color: #f8fafc !important;
}
select option:checked,
select option:hover {
 background-color: #1e293b !important;
 color: #38bdf8 !important;
}
body.light-mode select {
 color-scheme: light;
 background-color: #ffffff;
 color: #0f172a;
}
body.light-mode select option,
body.light-mode select optgroup {
 background-color: #ffffff !important;
 color: #0f172a !important;
}

/* ========================================================================= */
/* V7 — FOND ARDOISE DOUX, 3 THÈMES DE FOND, VUE CLAIRE BON COIN/ORG & UI   */
/* ========================================================================= */

/* Fond par défaut à droite de la barre latérale : Ardoise Doux (moins sombre) */
#main-view {
 background: radial-gradient(circle at 15% 0%, rgba(14, 165, 233, 0.08) 0%, rgba(22, 32, 51, 0.96) 45%, rgba(15, 23, 42, 0.98) 100%);
 transition: background 0.25s ease, color 0.25s ease;
}

/* 3 choix de thème de fond sur la zone principale */
body.fs-bg-slate #main-view {
 background: radial-gradient(circle at 15% 0%, rgba(14, 165, 233, 0.09) 0%, rgba(22, 32, 51, 0.96) 48%, rgba(18, 26, 43, 0.98) 100%);
}
body.fs-bg-light #main-view {
 background: #f1f5f9 !important;
 color: #0f172a !important;
}
body.fs-bg-deep #main-view {
 background: #020617 !important;
 color: #f8fafc !important;
}

/* Fond clair (blanc / gris perle) dédié aux sections "Organisations" et "Le Bon Coin" */
body.fs-light-section #main-view {
 background: linear-gradient(180deg, #f8fafc 0%, #eef2f6 100%) !important;
 color: #0f172a !important;
}
body.fs-light-section #main-view .glass-panel,
body.fs-light-section #main-view .fs-lbc-card {
 background: #ffffff !important;
 color: #0f172a !important;
 border-color: #cbd5e1 !important;
 box-shadow: 0 4px 18px rgba(15, 23, 42, 0.05);
}
body.fs-light-section #main-view h2,
body.fs-light-section #main-view h3,
body.fs-light-section #main-view h4,
body.fs-light-section #main-view .text-white {
 color: #0f172a !important;
}
body.fs-light-section #main-view .text-slate-400,
body.fs-light-section #main-view .text-slate-300 {
 color: #475569 !important;
}
body.fs-light-section #main-view .bg-white\/5,
body.fs-light-section #main-view .bg-black\/40,
body.fs-light-section #main-view .bg-black\/30 {
 background-color: #f1f5f9 !important;
 border-color: #cbd5e1 !important;
 color: #0f172a !important;
}

/* Indicateur espace dispo HDD dans le pied de la barre latérale */
.fs-hdd-widget {
 background: rgba(30, 41, 59, 0.72);
 border: 1px solid rgba(148, 163, 184, 0.18);
 border-radius: 12px;
 padding: 9px 11px;
}
.fs-hdd-bar-bg {
 width: 100%;
 height: 6px;
 border-radius: 999px;
 background: rgba(15, 23, 42, 0.8);
 overflow: hidden;
 margin: 5px 0 4px;
}
.fs-hdd-bar-fill {
 height: 100%;
 border-radius: 999px;
 background: linear-gradient(90deg, #10b981, #38bdf8);
 transition: width 0.3s ease;
}

/* ========================================================================= */
/* V7.1 — PERSONNALISATION COMPLÈTE UTILISATEUR (VARIABLES DYNAMIQUES)       */
/* ========================================================================= */
:root {
 --fs-main-bg: #162033;
 --fs-sidebar-bg: #0f172a;
 --fs-card-bg: rgba(15, 23, 42, 0.78);
 --fs-header-bg: rgba(15, 23, 42, 0.85);
 --fs-text-main: #f8fafc;
 --fs-border-soft: rgba(255, 255, 255, 0.12);
 --fs-font-heading: 'Outfit', sans-serif;
 --fs-font-body: 'Inter', sans-serif;
 --fs-radius-card: 1.25rem;
}

body {
 font-family: var(--fs-font-body);
}
h1, h2, h3, .font-heading {
 font-family: var(--fs-font-heading);
}
#sidebar {
 background: var(--fs-sidebar-bg) !important;
 border-color: var(--fs-border-soft) !important;
}
#main-view {
 background: var(--fs-main-bg) !important;
 color: var(--fs-text-main);
}
#main-view .glass-panel {
 background: var(--fs-card-bg) !important;
 border-color: var(--fs-border-soft) !important;
 border-radius: var(--fs-radius-card);
}
body.fs-light-section #main-view {
 background: linear-gradient(180deg, #f8fafc 0%, #eef2f6 100%) !important;
 color: #0f172a !important;
}
body.fs-light-section #main-view .glass-panel,
body.fs-light-section #main-view .fs-lbc-card {
 background: #ffffff !important;
 color: #0f172a !important;
 border-color: #cbd5e1 !important;
}

/* Sécurité d'affichage du logo latéral sur fond noir (indépendant du CDN Tailwind) */
.fs-sidebar-brand-box {
 display: flex !important;
 align-items: center;
 justify-content: space-between;
 gap: 6px;
 background: #000000 !important;
 padding: 8px;
 border-radius: 1rem;
}
.fs-sidebar-logo-wrap {
 width: 112px !important;
 height: 112px !important;
 min-width: 112px !important;
 min-height: 112px !important;
 background: #000000 !important;
 display: flex;
 align-items: center;
 justify-content: center;
}

.vault-mode-3d-grid {
 display: grid;
 grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
 gap: 18px;
 align-items: end;
}
