:root {
    --bg-color: #07090f;
    --panel-bg: rgba(12, 16, 26, 0.78);
    --panel-border: rgba(0, 243, 255, 0.22);
    --text-primary: #e8eef7;
    --text-secondary: #8b9bb4;
    --accent-color: #00f3ff;
    --accent-soft: rgba(0, 243, 255, 0.14);
    --accent-hover: #5ef7ff;
    --danger-color: #ff4d79;
    --success-color: #2dffb0;
    --font-main: 'Outfit', sans-serif;
    --blur-amount: 14px;
    --blur-amount-mobile: 4px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-soft: 0 12px 40px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 0 28px rgba(0, 243, 255, 0.18);
}

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

body, html {
    width: 100%;
    height: 100%;
    font-family: var(--font-main);
    color: var(--text-primary);
    background-color: var(--bg-color);
    overflow: hidden;
}

/* --- Réglages tactiles globaux (mobile) --- */
html {
    -webkit-tap-highlight-color: transparent;
}

body {
    overscroll-behavior: none; /* pas de pull-to-refresh / rebond parasite */
}

/* Pas de sélection de texte ni de menu long-press sur les éléments interactifs */
button, .menu-item, .zone-row, .key, .panel-toggle, .locate-btn, .sync-refresh,
.edit-bar-btn, .gallery-btn, .toast-close, .draw-hint-cancel, .draw-hint-locate,
.color-swatch, .leaflet-interactive {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* La carte gère tous ses gestes elle-même (pinch, pan) : le navigateur ne doit
   jamais zoomer la page ni afficher le menu de double-tap dessus. */
.leaflet-container {
    touch-action: none;
}

/* Map Container */
#map {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}


/* Glassmorphism utility */
.glass-panel {
    background:
        linear-gradient(165deg, rgba(22, 28, 42, 0.72), rgba(10, 13, 20, 0.82)),
        var(--panel-bg);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* --- Top Bar --- */
.topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 20px;
    /* Fond plus opaque, SANS backdrop-filter : les couches floutées permanentes
       provoquaient un flash noir au retour du sélecteur de photos / du navigateur. */
    background:
        linear-gradient(180deg, rgba(12, 16, 26, 0.98), rgba(8, 10, 16, 0.94));
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.4);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
}

.topbar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 243, 255, 0.55), transparent);
    pointer-events: none;
}

.topbar.hidden {
    transform: translateY(-120%);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.topbar-name {
    font-size: 1.28rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    white-space: nowrap;
    background: linear-gradient(180deg, #ffffff 35%, #b8f9ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.topbar-stats {
    display: flex;
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.topbar-title-mobile {
    display: none;
}

.stat {
    font-size: 0.74rem;
    color: var(--text-secondary);
    display: flex;
    align-items: baseline;
    gap: 5px;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.stat b {
    color: var(--accent-color);
    font-size: 1.02rem;
    font-weight: 700;
    text-shadow: 0 0 12px rgba(0, 243, 255, 0.35);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar .layer-toggle {
    width: auto;
    padding: 5px 12px;
    gap: 9px;
    font-size: 0.76rem;
    border-radius: 10px;
}

.topbar .layer-toggle label {
    white-space: nowrap;
    cursor: pointer;
}

.topbar .switch {
    width: 34px;
    height: 19px;
}

.topbar .slider:before {
    height: 13px;
    width: 13px;
    left: 3px;
    bottom: 3px;
}

.topbar input:checked + .slider:before {
    transform: translateX(15px);
}

/* --- Menu ⋯ (barre supérieure) --- */
.topbar-menu {
    position: relative;
}

.menu-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.menu-btn:hover, .menu-btn.open {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(0, 243, 255, 0.1);
}

.menu-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    min-width: 236px;
    background:
        linear-gradient(180deg, rgba(20, 26, 38, 0.98), rgba(10, 12, 18, 0.98));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 243, 255, 0.16);
    border-radius: var(--radius-md);
    padding: 8px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), var(--shadow-glow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.2s;
    z-index: 1600;
}

.menu-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    text-align: left;
}

.menu-item:hover {
    background: rgba(0, 243, 255, 0.1);
    color: var(--accent-color);
}

.menu-item svg {
    flex-shrink: 0;
}

.menu-item-wrap {
    position: relative;
}

.menu-item-wrap input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.menu-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 6px 8px;
}

.menu-item.logout-item {
    color: #ff6b81;
}

.menu-item.logout-item:hover {
    background: rgba(255, 51, 102, 0.12);
    border-color: rgba(255, 51, 102, 0.4);
    color: #ff8095;
}

/* --- UI Panels --- */

.side-panel {
    position: absolute;
    top: 84px;
    left: 20px;
    width: 332px;
    z-index: 1000;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
    box-shadow: var(--shadow-soft), var(--shadow-glow);
}

.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
}
.side-panel.hidden {
    transform: translateX(-120%);
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.sync-refresh {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.sync-refresh:hover {
    background: rgba(255, 255, 255, 0.12);
}

.sync-refresh:active {
    transform: scale(0.9);
}

.sync-refresh.spinning svg {
    animation: spin 0.8s linear infinite;
}

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

.sync-chrono {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    min-width: 26px;
    text-align: center;
    white-space: nowrap;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--success-color);
    box-shadow: 0 0 10px var(--success-color), 0 0 22px rgba(45, 255, 176, 0.35);
    flex-shrink: 0;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    animation: status-breathe 2.8s ease-in-out infinite;
}

@keyframes status-breathe {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.12); opacity: 0.85; }
}

.status-indicator.syncing {
    background-color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color);
}

.status-indicator.drawing {
    background-color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color);
    animation: pulse 1.5s infinite;
}

/* --- Splash screen --- */
.splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 50% 38%, rgba(0, 243, 255, 0.12), transparent 42%),
        radial-gradient(ellipse at 50% 40%, #121a2a 0%, #07090f 68%);
    transition: opacity 0.6s ease, visibility 0.6s ease;
    overflow: hidden;
}

.splash::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(0, 243, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 243, 255, 0.035) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse at 50% 45%, #000 20%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 45%, #000 20%, transparent 70%);
    pointer-events: none;
    opacity: 0.7;
}

.splash.hide {
    opacity: 0;
    visibility: hidden;
    /* Léger délai : le fond reste le temps que l'éclair atteigne le logo
       du login, puis s'estompe pendant que la carte est déjà en place. */
    transition: opacity 0.4s ease 0.15s, visibility 0s linear 0.65s;
}

.splash-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.splash-bolt {
    width: 74px;
    height: 74px;
    color: var(--accent-color);
    overflow: visible;
    filter: drop-shadow(0 0 14px rgba(0, 243, 255, 0.8));
    stroke-dasharray: 240;
    stroke-dashoffset: 240;
    animation: splash-draw 1s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

@keyframes splash-draw {
    to { stroke-dashoffset: 0; }
}

.splash-name {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 7px;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 0 0 22px rgba(0, 243, 255, 0.55), 0 0 48px rgba(0, 243, 255, 0.2);
    animation: splash-fade 1.2s ease forwards;
}

@keyframes splash-fade {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.splash-glow {
    width: 140px;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
    box-shadow: 0 0 18px rgba(0, 243, 255, 0.55);
    animation: splash-glowbar 1.4s ease infinite;
}

@keyframes splash-glowbar {
    0% { opacity: 0.15; transform: scaleX(0.3); }
    50% { opacity: 1; transform: scaleX(1); }
    100% { opacity: 0.15; transform: scaleX(0.3); }
}

/* --- Transition splash → login (le splash lui-même n'est pas modifié) --- */
.splash.leaving .splash-inner {
    animation: splash-burst 0.48s ease-in forwards;
}
@keyframes splash-burst {
    to { transform: scale(1.07); filter: brightness(1.6); }
}
.splash.leaving .splash-bolt {
    filter: drop-shadow(0 0 28px rgba(0, 243, 255, 0.95));
    transition: filter 0.4s ease;
}
.splash.leaving::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 45%, rgba(0, 243, 255, 0.3), transparent 55%);
    opacity: 0;
    animation: splash-bloom 0.5s ease-out forwards;
    pointer-events: none;
}
@keyframes splash-bloom {
    to { opacity: 1; }
}

/* L'éclair du splash VOLE vers le logo de la carte de connexion (FLIP :
   --morph-x/y/scale sont posés en JS depuis les positions mesurées). Le vol
   dure 0,7 s et se termine sur un fondu rapide ; le nom et la barre de glow
   s'estompent pendant que la carte entre en scène. */
.splash.morphing .splash-inner {
    animation: none; /* annule le burst (x1,07) pour ne pas fausser l'atterrissage */
}
.splash.morphing .splash-bolt {
    transform: translate(var(--morph-x, 0px), var(--morph-y, 0px)) scale(var(--morph-scale, 1));
    opacity: 0;
    transition: transform 0.7s cubic-bezier(0.45, 0, 0.25, 1), opacity 0.18s ease 0.52s;
}
.splash.morphing .splash-name,
.splash.morphing .splash-glow {
    opacity: 0;
    transition: opacity 0.25s ease;
}

/* Le login entre en scène : soulèvement + flou qui se dissipe */
.glass-panel-overlay.enter .login-container {
    animation: login-rise 0.8s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}
@keyframes login-rise {
    from { opacity: 0; transform: translateY(30px) scale(0.94); filter: blur(7px); }
    to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
/* Reflet lumineux qui balaie la carte de connexion à l'entrée */
.glass-panel-overlay.enter .login-container::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 55%;
    height: 100%;
    background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.12), transparent);
    transform: translateX(-140%) skewX(-14deg);
    animation: login-sheen 1.1s ease 0.35s forwards;
    pointer-events: none;
}
@keyframes login-sheen {
    to { transform: translateX(320%) skewX(-14deg); }
}
/* Faisceau lumineux qui balaie l'écran pendant que le splash s'estompe */
.splash.hide::before {
    content: "";
    position: absolute;
    inset: -25%;
    background: linear-gradient(100deg, transparent 32%, rgba(0, 243, 255, 0.22) 50%, transparent 68%);
    transform: translateX(-130%) rotate(6deg);
    animation: splash-beam 0.9s ease-out forwards;
    pointer-events: none;
}
@keyframes splash-beam {
    to { transform: translateX(130%) rotate(6deg); }
}

/* --- Transition login → dashboard --- */
/* Pulse de succès : le code correct fait briller les pastilles en vert */
.login-container.success {
    animation: login-success 0.3s ease;
}
@keyframes login-success {
    0% { transform: scale(1); }
    40% { transform: scale(1.045); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65), 0 0 60px rgba(0, 243, 255, 0.35); }
    100% { transform: scale(1); }
}
.login-container.success .pin-slot.filled {
    background: #3dff9b;
    border-color: #3dff9b;
    box-shadow: 0 0 14px rgba(61, 255, 155, 0.9);
}

/* Sortie : la carte de connexion se dilate et s'efface pendant qu'un anneau
   lumineux se propage depuis le centre de l'écran (portail) */
.glass-panel-overlay.leaving .login-container {
    animation: login-out 0.45s ease-in forwards;
}
@keyframes login-out {
    to { opacity: 0; transform: scale(1.12); filter: blur(6px); }
}
.glass-panel-overlay.leaving::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 220px;
    height: 220px;
    margin: -110px 0 0 -110px;
    border-radius: 50%;
    border: 3px solid rgba(0, 243, 255, 0.9);
    box-shadow: 0 0 70px rgba(0, 243, 255, 0.65), inset 0 0 70px rgba(0, 243, 255, 0.4);
    opacity: 0;
    animation: portal-out 0.6s ease-out forwards;
    pointer-events: none;
}
@keyframes portal-out {
    0% { opacity: 1; transform: scale(0.15); }
    100% { opacity: 0; transform: scale(6); }
}

/* --- Buttons --- */
/* Boutons d'actions génériques (modales) */
.actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* --- Création : 3 cartes claires --- */
.create-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.create-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.create-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.create-cards.hidden {
    display: none;
}

.create-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 12px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    color: var(--text-primary);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.create-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}

.create-card:active {
    transform: scale(0.98);
}

.create-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.create-card-zone .create-card-icon {
    background: rgba(0, 243, 255, 0.12);
    color: var(--accent-color);
    border: 1px solid rgba(0, 243, 255, 0.35);
}
.create-card-zone:hover {
    border-color: rgba(0, 243, 255, 0.55);
    background: rgba(0, 243, 255, 0.08);
}

.create-card-panel .create-card-icon {
    background: rgba(120, 180, 255, 0.12);
    color: #9ec5ff;
    border: 1px solid rgba(120, 180, 255, 0.35);
}
.create-card-panel:hover {
    border-color: rgba(120, 180, 255, 0.55);
    background: rgba(120, 180, 255, 0.08);
}

.create-card-supposed .create-card-icon {
    background: rgba(255, 209, 102, 0.12);
    color: #ffd166;
    border: 1px solid rgba(255, 209, 102, 0.4);
}
.create-card-supposed:hover {
    border-color: rgba(255, 209, 102, 0.6);
    background: rgba(255, 209, 102, 0.08);
}

.create-card-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.create-card-title {
    font-size: 0.95rem;
    font-weight: 700;
}

.create-card-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.create-active-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.create-kind-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: 1px solid rgba(0, 243, 255, 0.35);
    background: rgba(0, 243, 255, 0.1);
    color: var(--accent-color);
    white-space: nowrap;
}
.create-kind-badge.kind-panel {
    border-color: rgba(120, 180, 255, 0.45);
    background: rgba(120, 180, 255, 0.12);
    color: #9ec5ff;
}
.create-kind-badge.kind-supposed {
    border-color: rgba(255, 209, 102, 0.5);
    background: rgba(255, 209, 102, 0.12);
    color: #ffd166;
}

.create-step-badge,
.create-count-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    white-space: nowrap;
}

.create-count-badge {
    color: var(--accent-color);
    border-color: rgba(0, 243, 255, 0.25);
    font-variant-numeric: tabular-nums;
}

.side-panel.creating .instructions {
    border-left-color: var(--success-color);
    background: linear-gradient(135deg, rgba(0, 255, 157, 0.08), rgba(255,255,255,0.03));
}

/* Legacy aliases (si d'anciennes classes restent) */
.add-alt-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.add-alt-actions.hidden {
    display: none;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.98rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
}

.btn.primary {
    background: linear-gradient(180deg, rgba(0, 243, 255, 0.18), rgba(0, 243, 255, 0.08));
    color: var(--accent-color);
    border: 1px solid rgba(0, 243, 255, 0.55);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 18px rgba(0, 243, 255, 0.08);
}

.btn.primary:hover {
    background: linear-gradient(180deg, #5ef7ff, #00e0ea);
    color: #061018;
    box-shadow: 0 0 22px rgba(0, 243, 255, 0.55);
    transform: translateY(-1px);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.045);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 243, 255, 0.28);
}

.btn.warning {
    background: linear-gradient(180deg, rgba(255, 77, 121, 0.16), rgba(255, 51, 102, 0.08));
    color: var(--danger-color);
    border: 1px solid rgba(255, 77, 121, 0.55);
}
.btn.warning:hover {
    background: var(--danger-color);
    color: white;
    box-shadow: 0 0 18px rgba(255, 51, 102, 0.45);
}

/* Bouton « Valider les points d'attache » (étape 1, desktop) */
.btn.validate {
    background-color: rgba(0, 255, 157, 0.1);
    color: #00ff9d;
    border: 1px solid #00ff9d;
}
.btn.validate:hover {
    background-color: #00ff9d;
    color: var(--bg-color);
    box-shadow: 0 0 15px rgba(0, 255, 157, 0.7);
}


.file-upload-wrapper {
    position: relative;
    width: 100%;
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.instructions {
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.06), rgba(255,255,255,0.03));
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
    border: 1px solid rgba(0, 243, 255, 0.12);
    border-left: 3px solid var(--accent-color);
}

/* --- Layer Toggle --- */
.layer-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.05);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255,255,255,0.2);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

.custom-input {
    width: 100%;
    padding: 12px 13px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.custom-input:focus {
    outline: none;
    border-color: rgba(0, 243, 255, 0.65);
    background: rgba(0, 20, 28, 0.35);
    box-shadow: 0 0 0 3px rgba(0, 243, 255, 0.12), 0 0 18px rgba(0, 243, 255, 0.2);
}
.desc-input {
    resize: vertical;
    min-height: 56px;
    line-height: 1.4;
    font-size: 0.9rem;
    margin-bottom: 2px;
}
.stats-box {
    background: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

/* --- Floating Menu ---
   Pas de backdrop-filter ici : l'empilement de blurs (menu + toast + carte)
   au moment de la fermeture provoquait un flash d'écran noir sur Android. */
.floating-menu {
    position: absolute;
    z-index: 3000;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(1);
    width: 280px;
    max-height: 88vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(16, 18, 27, 0.98);
    border: 1px solid var(--accent-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    padding: 15px;
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.floating-menu.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.8);
}

.menu-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

.menu-header-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
}

.menu-header h3 {
    margin: 0;
    font-size: 1.05rem;
    color: white;
    border: none;
    padding: 0;
}

.small-input {
    padding: 8px;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.small-btn {
    padding: 8px;
    font-size: 0.85rem;
}
/* --- Zone List --- */
.zone-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 243, 255, 0.12);
    padding-bottom: 10px;
    margin-top: 4px;
}

.zone-list-header h3 {
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    color: var(--text-primary);
    text-transform: uppercase;
}

.zone-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
}

.zone-list-empty {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    padding: 8px;
}

.zone-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: rgba(255,255,255,0.035);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-sm);
    padding: 9px 11px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.zone-row:hover {
    border-color: rgba(0, 243, 255, 0.45);
    background: rgba(0, 243, 255, 0.07);
    transform: translateX(2px);
    box-shadow: 0 0 16px rgba(0, 243, 255, 0.08);
}

.zone-row-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.zone-row-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.zone-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text-primary);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.zone-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.zone-btn.delete:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
    background: rgba(255, 51, 102, 0.1);
}

/* Badge de type dans la liste des zones (supposée / panneau repéré) */
.zone-row-badge {
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 5px;
    padding: 1px 5px;
    white-space: nowrap;
    align-self: center;
}
.zone-row-badge.supposed {
    color: #ffd166;
    border-color: rgba(255, 209, 102, 0.55);
    background: rgba(255, 209, 102, 0.08);
}

/* --- Login Modal --- */
.glass-panel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(0, 243, 255, 0.1), transparent 45%),
        radial-gradient(ellipse at 80% 80%, rgba(80, 40, 160, 0.08), transparent 40%),
        rgba(4, 6, 12, 0.72);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
    overflow: hidden;
}

.glass-panel-overlay:not(.active) {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.login-ambiance {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.login-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.55;
    animation: orb-drift 12s ease-in-out infinite alternate;
}

.login-orb-a {
    width: 280px;
    height: 280px;
    top: 12%;
    left: 8%;
    background: rgba(0, 243, 255, 0.22);
}

.login-orb-b {
    width: 320px;
    height: 320px;
    right: 4%;
    bottom: 8%;
    background: rgba(70, 90, 255, 0.16);
    animation-delay: -4s;
}

@keyframes orb-drift {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(24px, -18px) scale(1.08); }
}

.login-container {
    width: 352px;
    max-width: calc(100vw - 36px);
    padding: 36px 28px 26px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(165deg, rgba(20, 26, 40, 0.96), rgba(8, 10, 16, 0.98));
    border: 1px solid rgba(0, 243, 255, 0.22);
    box-shadow:
        0 28px 80px rgba(0, 0, 0, 0.7),
        0 0 60px rgba(0, 243, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Halo néon derrière le logo */
.login-container::before {
    content: "";
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    height: 150px;
    background: radial-gradient(ellipse, rgba(0, 243, 255, 0.28), transparent 70%);
    pointer-events: none;
}

.login-container.shake {
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
}

/* Éclair : l'éclair de base reste tracé, et une impulsion lumineuse descend
   de la pointe vers le bas, puis continue depuis le haut (boucle sans retour
   en arrière, comme l'énergie du splash). */
.neon-icon {
    color: var(--accent-color);
    overflow: visible;
    filter: drop-shadow(0 0 10px rgba(0, 243, 255, 0.55));
}

.neon-icon .bolt-energy {
    stroke: #d8fcff;
    stroke-dasharray: 52 188;
    stroke-dashoffset: 240;
    filter: drop-shadow(0 0 7px rgba(0, 243, 255, 0.95));
    animation: bolt-flow 3s linear infinite;
}

@keyframes bolt-flow {
    to { stroke-dashoffset: 0; }
}

.login-container h1 {
    font-size: 1.78rem;
    font-weight: 800;
    letter-spacing: 1.2px;
    background: linear-gradient(180deg, #fff 30%, #b8f9ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.login-sub {
    font-size: 0.78rem;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.pin-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 54px;
    padding: 8px 0;
}

.pin-slot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.24);
    background: transparent;
    transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.22s cubic-bezier(0.22, 1.4, 0.36, 1);
}

.pin-slot.filled {
    background: var(--accent-color);
    border-color: var(--accent-color);
    box-shadow: 0 0 14px rgba(0, 243, 255, 0.85), 0 0 28px rgba(0, 243, 255, 0.35);
    transform: scale(1.18);
    animation: pin-pop 0.28s cubic-bezier(0.22, 1.5, 0.36, 1);
}

@keyframes pin-pop {
    from { transform: scale(0.6); opacity: 0.4; }
    to { transform: scale(1.18); opacity: 1; }
}

/* Item du menu empreinte/passkey : visible sur tous les appareils (le
   libellé change selon l'écran : « Empreinte digitale » mobile, « Passkey » PC). */
.fingerprint-menu-item {
    display: flex;
}

/* Item du menu : uniquement sur ordinateur (clavier physique) */
.shortcuts-menu-item {
    display: flex;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 11px;
}

.key {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-size: 1.32rem;
    font-weight: 600;
    font-family: inherit;
    height: 58px;
    border-radius: 16px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.key:hover {
    background: rgba(0, 243, 255, 0.14);
    border-color: rgba(0, 243, 255, 0.55);
    color: var(--accent-color);
    box-shadow: 0 0 16px rgba(0, 243, 255, 0.18);
}

.key:active {
    transform: scale(0.92);
    background: rgba(0, 243, 255, 0.22);
}

.key.action {
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

/* Libellés selon l'appareil : « empreinte / Empreinte digitale » sur téléphone,
   « passkey / Se connecter avec une passkey » sur PC (largeur > 820 px). */
.fp-label-desktop {
    display: none;
}
@media (min-width: 821px) {
    .fp-label-mobile {
        display: none;
    }
    .fp-label-desktop {
        display: inline;
    }
}

/* Bouton manuel « Utiliser l'empreinte digitale » sous le pavé : séparateur
   « ou » + bouton. Visible uniquement quand une empreinte est enregistrée. */
.fp-login-section {
    margin-top: 18px;
    animation: fpFadeIn 0.3s ease;
}

.fp-login-section.hidden {
    display: none;
}

.fp-or-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
}

.fp-or-divider::before,
.fp-or-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.12);
}

.fp-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    border-radius: 14px;
    background: rgba(0, 243, 255, 0.08);
    border: 1px solid rgba(0, 243, 255, 0.35);
    color: var(--accent-color);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.fp-login-btn:hover {
    background: rgba(0, 243, 255, 0.16);
    border-color: rgba(0, 243, 255, 0.6);
}

.fp-login-btn:active {
    transform: scale(0.96);
}

@keyframes fpFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}



.error-msg {
    color: var(--danger-color) !important;
    font-weight: 600;
    min-height: 20px;
    font-size: 0.82rem;
    animation: shake 0.4s ease;
}
.error-msg.hidden {
    opacity: 0;
}

/* Animations */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 243, 255, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(0, 243, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 243, 255, 0); }
}

/* --- Zone row extras --- */
.zone-swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.25);
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.zone-swatch:hover {
    transform: scale(1.15);
    border-color: var(--accent-color);
}

.zone-photo-badge {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.zone-filter {
    margin-bottom: 2px;
}

/* --- Color swatches --- */
.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
}

.color-swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.color-swatch:hover {
    transform: scale(1.12);
}

.color-swatch.selected {
    border-color: white;
    box-shadow: 0 0 0 2px var(--bg-color), 0 0 10px rgba(255,255,255,0.35);
    transform: scale(1.12);
}

/* Bouton "+" : cercle arc-en-ciel avec cœur sombre */
.color-swatch-custom {
    position: relative;
    background: conic-gradient(from 0deg, #ff4d4d, #ffb020, #b6f34a, #00ff9d, #00f3ff, #4d88ff, #a06bff, #ff4dd8, #ff4d4d) !important;
    border: 2px solid rgba(255, 255, 255, 0.35);
    overflow: hidden;
}
.color-swatch-custom::before {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: var(--bg-color);
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.6);
}
.color-swatch-custom::after {
    content: '+';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.8);
}
.color-swatch-custom:hover {
    transform: scale(1.12);
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.5);
}

/* Popover de couleur au-dessus de la liste */
.color-popover {
    position: fixed;
    z-index: 5000;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    width: max-content;
    max-width: min(340px, calc(100vw - 24px));
}

/* --- Sélecteur de couleur personnalisé (intégré au site) --- */
.color-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 7000;
    background: rgba(5, 5, 8, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: picker-in 0.18s ease;
}
.color-picker-box {
    width: min(320px, calc(100vw - 36px));
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    border-color: rgba(0, 243, 255, 0.35);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 243, 255, 0.08);
}
.color-picker-box h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    letter-spacing: 0.3px;
}
.cp-preview-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.cp-preview {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
    transition: background 0.08s linear, box-shadow 0.08s linear;
}
.cp-hex {
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.95rem;
    padding: 11px 12px;
    outline: none;
    text-transform: uppercase;
}
.cp-hex:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 243, 255, 0.15);
}
.cp-canvas-wrap {
    position: relative;
    height: 160px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    touch-action: none;
    cursor: crosshair;
}
.cp-sv {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}
.cp-sv-cursor {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 0 8px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    transform: translate(-50%, -50%);
}
.cp-hue-wrap {
    position: relative;
    height: 22px;
    touch-action: none;
    cursor: pointer;
}
.cp-hue {
    height: 100%;
    border-radius: 11px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: linear-gradient(to right,
        #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
}
.cp-hue-cursor {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 28px;
    border-radius: 7px;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 0 8px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    transform: translate(-50%, -50%);
}
.cp-actions {
    display: flex;
    gap: 10px;
}
.cp-actions .btn {
    flex: 1;
    padding: 11px;
}

@keyframes picker-in {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

/* --- Edit modal: photos --- */
.edit-section {
    margin-bottom: 12px;
}

.edit-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.edit-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* Case « infrastructure supposée » dans le menu de zone */
.edit-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px 10px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    transition: border-color 0.2s ease, background 0.2s ease;
}
.edit-check:hover {
    border-color: rgba(255, 209, 102, 0.55);
    background: rgba(255, 209, 102, 0.06);
}
.edit-check input {
    width: 17px;
    height: 17px;
    accent-color: #ffd166;
    cursor: pointer;
    flex-shrink: 0;
}
.edit-check em {
    font-style: normal;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.photo-counter {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}

.photo-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.3);
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
    display: block;
}

.photo-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    line-height: 1;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-remove:hover {
    background: var(--danger-color);
}

.photo-empty {
    grid-column: 1 / -1;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: center;
    padding: 8px;
    border: 1px dashed rgba(255,255,255,0.15);
    border-radius: 6px;
}

/* Badge de statut dans les popups (supposée / panneau repéré) */
.popup-tag {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    vertical-align: middle;
    margin-left: 5px;
    padding: 1px 6px;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.25);
    color: var(--text-secondary);
}
.popup-tag-supposed {
    color: #ffd166;
    border-color: rgba(255, 209, 102, 0.6);
    background: rgba(255, 209, 102, 0.1);
}
.popup-tag-panel {
    color: var(--accent-color);
    border-color: rgba(0, 243, 255, 0.55);
    background: rgba(0, 243, 255, 0.08);
}

/* --- Popup photos --- */
.popup-photos {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    align-items: center;
}

.popup-photo {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
    cursor: zoom-in;
    transition: transform 0.15s ease;
}    .popup-photo:hover {
        transform: scale(1.1);
    }

/* Bouton "Ouvrir dans Google Maps" dans la popup d'un point */
.popup-gmaps {
    margin-top: 8px;
}
.popup-gmaps-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.popup-gmaps-btn:hover {
    background: var(--accent-color);
    color: var(--bg-color);
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.5);
}

/* --- Étiquettes des noms de zones sur la carte (zoom ≥ 15) ---
   Pastille discrète centrée sur le vrai centre du polygone ; les noms trop
   longs sont tronqués avec une ellipse au lieu de déborder de la zone. */
.leaflet-tooltip.zone-label {
    background: rgba(8, 10, 15, 0.5);
    backdrop-filter: blur(2px);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 999px;
    box-shadow: none;
    padding: 2px 9px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    text-shadow: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
    cursor: pointer;
}
/* Apparition en fondu (entrée) — classe ajoutée/retirée par JS. Opacity +
   flou uniquement : le transform est réservé au positionnement Leaflet. */
.leaflet-tooltip.zone-label.zone-label-enter {
    animation: label-in 0.4s ease-out both;
}
@keyframes label-in {
    from { opacity: 0; filter: blur(3px); }
    to { opacity: 0.95; filter: blur(0); }
}
/* Disparition en fondu (sortie) — l'étiquette est retirée après l'animation */
.leaflet-tooltip.zone-label.zone-label-out {
    animation: label-out 0.34s ease-in forwards;
}
@keyframes label-out {
    from { opacity: 0.95; filter: blur(0); }
    to { opacity: 0; filter: blur(3px); }
}
.leaflet-tooltip.zone-label::before {
    display: none; /* pas de flèche */
}

.popup-photo-more {
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* --- Gallery (fullscreen) --- */
.gallery-overlay {
    position: fixed;
    inset: 0;
    z-index: 4000;
    background: rgba(5, 5, 8, 0.97);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.gallery-overlay.hidden {
    transform: none;
}

.gallery-stage {
    position: absolute;
    inset: 0;
    overflow: hidden;
    touch-action: none; /* indispensable pour le pincement / glisser sur mobile */
    -webkit-user-select: none;
    user-select: none;
}

.gallery-img {
    position: absolute;
    left: 50%;
    top: 50%;
    max-width: 92vw;
    max-height: 88vh;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    cursor: zoom-in;
    /* PAS de will-change ici : sur Chromium mobile, une grande image avec
       will-change est rastérisée en texture basse résolution -> flou et
       artefacts au zoom. Le transform reste fluide sans lui. */
    -webkit-user-drag: none;
    user-select: none;
    touch-action: none;
    transform-origin: center;
}

.gallery-hint {
    position: absolute;
    bottom: 66px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.55);
    padding: 6px 14px;
    border-radius: 20px;
    white-space: nowrap;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.gallery-hint.fade {
    opacity: 0;
}

.gallery-btn {
    position: absolute;
    z-index: 1;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.gallery-btn:hover {
    background: rgba(0, 243, 255, 0.25);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.gallery-close {
    top: 20px;
    right: 20px;
}

.gallery-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.gallery-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.gallery-counter {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-secondary);
    font-size: 0.9rem;
    background: rgba(0,0,0,0.5);
    padding: 4px 14px;
    border-radius: 20px;
}

/* --- Notifications (remplacent alert()) --- */
.toast-container {
    position: fixed;
    top: 74px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(440px, calc(100vw - 24px));
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 15px;
    border-radius: var(--radius-md);
    background: linear-gradient(165deg, rgba(18, 22, 34, 0.99), rgba(10, 12, 18, 0.99));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 3px solid var(--accent-color);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55), 0 0 24px rgba(0, 243, 255, 0.06);
    color: var(--text-primary);
    font-size: 0.86rem;
    line-height: 1.45;
    white-space: pre-line;
    animation: toastIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success { border-left-color: var(--success-color); }
.toast.error   { border-left-color: var(--danger-color); }
.toast.warning { border-left-color: #ffd166; }

.toast .toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast.success .toast-icon { color: var(--success-color); }
.toast.error .toast-icon   { color: var(--danger-color); }
.toast.warning .toast-icon { color: #ffd166; }
.toast.info .toast-icon    { color: var(--accent-color); }

.toast .toast-text { flex: 1; word-break: break-word; }

.toast-close {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.78rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.toast-close:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }
.toast.out { animation: toastOut 0.25s ease forwards; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-14px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
    to { opacity: 0; transform: translateY(-10px) scale(0.96); }
}

/* --- Confirmation stylée (remplace confirm()) --- */
.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 6500;
    background: rgba(5, 5, 8, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.confirm-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.confirm-box {
    width: min(360px, calc(100vw - 40px));
    padding: 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    border-color: rgba(255, 51, 102, 0.45);
    transition: border-color 0.2s ease;
}

.confirm-box.confirm-safe {
    border-color: rgba(0, 243, 255, 0.35);
}

.confirm-icon {
    color: var(--danger-color);
    filter: drop-shadow(0 0 8px rgba(255, 51, 102, 0.5));
}

.confirm-box.confirm-safe .confirm-icon,
.confirm-icon[data-tone="info"] {
    color: var(--accent-color);
    filter: drop-shadow(0 0 8px rgba(0, 243, 255, 0.45));
}

.confirm-icon-svg { display: none; }
.confirm-icon[data-tone="danger"] .confirm-icon-warn,
.confirm-icon:not([data-tone]) .confirm-icon-warn { display: block; }
.confirm-icon[data-tone="info"] .confirm-icon-info { display: block; }

.confirm-box h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.confirm-box p { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.5; }
.confirm-actions { display: flex; gap: 10px; width: 100%; margin-top: 6px; }

/* Map Overrides */
.leaflet-container {
    background: var(--bg-color);
    font-family: var(--font-main);
}
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: var(--panel-bg);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
    border: 1px solid var(--panel-border);
}
.leaflet-popup-content {
    font-size: 0.95rem;
}
.leaflet-bar a {
    background-color: var(--panel-bg) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid rgba(255,255,255,0.1) !important;
}
.leaflet-bar a:hover {
    background-color: rgba(0, 243, 255, 0.2) !important;
    color: var(--accent-color) !important;
}
.leaflet-control-zoom {
    border: 1px solid var(--panel-border) !important;
}

/* Contrôles Leaflet sous la barre supérieure */
.leaflet-top.leaflet-right {
    top: 76px;
}

/* Cursor custom */
.crosshair-cursor-enabled {
    cursor: crosshair !important;
}

/* --- Bouton hamburger + satellite (masqués sur desktop) --- */
.panel-toggle {
    display: none;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.panel-toggle:hover, .panel-toggle.open {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(0, 243, 255, 0.1);
}

.sat-toggle {
    display: none;
}

.menu-item .menu-check {
    margin-left: auto;
    opacity: 0;
    color: var(--accent-color);
    font-weight: 700;
    transition: opacity 0.15s ease;
}

.menu-item.active .menu-check {
    opacity: 1;
}

.menu-item.active {
    color: var(--accent-color);
}

.panel-backdrop {
    display: none;
}

.draw-hint {
    display: none;
}

/* Viseur + contrôles de tracé mobile (masqués par défaut, visibles dans la media query) */
.crosshair-overlay,
.crosshair-controls {
    display: none;
}

/* --- Marqueur GPS stylé (anneau pulsant, sans cercle d'approximation) --- */
.gps-marker {
    background: transparent;
    border: none;
}
.gps-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: var(--accent-color);
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.95);
}
.gps-ring,
.gps-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid rgba(0, 243, 255, 0.75);
    transform: translate(-50%, -50%);
    animation: gps-wave 2.2s ease-out infinite;
}
.gps-pulse {
    border-width: 1.5px;
    opacity: 0.5;
    animation-delay: 0.7s;
}
@keyframes gps-wave {
    0% { transform: translate(-50%, -50%) scale(0.4); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2.2); opacity: 0; }
}
.leaflet-tooltip.gps-acc {
    background: rgba(9, 12, 18, 0.85);
    border: 1px solid rgba(0, 243, 255, 0.35);
    color: var(--accent-color);
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 6px;
    padding: 2px 7px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}
.leaflet-tooltip.gps-acc::before {
    display: none;
}

/* --- Raccourcis clavier (modale) --- */
.shortcuts-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: rgba(5, 5, 8, 0.65);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
}
.shortcuts-overlay.hidden {
    display: none;
}
.shortcuts-box {
    width: 400px;
    max-width: calc(100vw - 36px);
    padding: 22px 24px;
    border-radius: 18px;
    background: linear-gradient(165deg, rgba(17, 22, 34, 0.96), rgba(9, 11, 17, 0.98));
    border: 1px solid rgba(0, 243, 255, 0.18);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65), 0 0 46px rgba(0, 243, 255, 0.06);
    animation: modal-pop 0.3s cubic-bezier(0.22, 1.2, 0.36, 1);
}
@keyframes modal-pop {
    from { opacity: 0; transform: translateY(14px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.shortcuts-box .menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.shortcuts-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
}
.shortcuts-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}
.shortcuts-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0 0 12px;
}
.shortcut-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.88rem;
}
.shortcut-row:last-child {
    border-bottom: none;
}
.kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-bottom-width: 2px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent-color);
}

/* --- Statistiques (panneau complet) --- */
.stats-overlay {
    position: fixed;
    inset: 0;
    z-index: 5100;
    background: rgba(5, 5, 8, 0.7);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.stats-overlay.hidden {
    display: none;
}
.stats-box {
    width: 680px;
    max-width: 100%;
    max-height: calc(100dvh - 40px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: linear-gradient(165deg, rgba(17, 22, 34, 0.98), rgba(9, 11, 17, 0.99));
    border: 1px solid rgba(0, 243, 255, 0.18);
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 50px rgba(0, 243, 255, 0.06);
    animation: modal-pop 0.3s cubic-bezier(0.22, 1.2, 0.36, 1);
}
.stats-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.stats-header h3 {
    font-size: 1.15rem;
}
.stats-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 3px;
}
.stats-content {
    overflow-y: auto;
    padding: 18px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Cartes KPI */
.stats-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.stat-kpi {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 12px 14px;
    animation: modal-pop 0.4s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}
.stat-kpi:nth-child(2) { animation-delay: 0.05s; }
.stat-kpi:nth-child(3) { animation-delay: 0.1s; }
.stat-kpi:nth-child(4) { animation-delay: 0.15s; }
.kpi-label {
    font-size: 0.66rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.7px;
}
.kpi-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent-color);
    margin-top: 2px;
    line-height: 1.1;
}
.kpi-value .kpi-unit {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-left: 2px;
}
.kpi-sub {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 3px;
}

/* Titres de section */
.stats-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.stats-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.9px;
    color: rgba(255, 255, 255, 0.88);
    display: flex;
    align-items: center;
    gap: 8px;
}
.stats-section-title svg {
    color: var(--accent-color);
}

/* Donut + légende */
.donut-wrap {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
}
.donut-box {
    position: relative;
    width: 150px;
    height: 150px;
    flex-shrink: 0;
}
.donut-box svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.donut-box svg circle {
    transition: stroke-dasharray 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.donut-center b {
    font-size: 1.05rem;
    color: var(--accent-color);
}
.donut-center span {
    font-size: 0.68rem;
    color: var(--text-secondary);
}
.donut-legend {
    flex: 1;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.donut-legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
}
.donut-legend-row .l-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}
.donut-legend-row .l-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.donut-legend-row .l-val {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* Classement */
.rank-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.rank-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 10px;
}
.rank-row:nth-child(odd) {
    background: rgba(255, 255, 255, 0.03);
}
.rank-badge {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.74rem;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}
.rank-row:nth-child(1) .rank-badge {
    background: linear-gradient(135deg, #ffe066, #d4a017);
    color: #1a1400;
}
.rank-row:nth-child(2) .rank-badge {
    background: linear-gradient(135deg, #e8e8e8, #a8a8a8);
    color: #141414;
}
.rank-row:nth-child(3) .rank-badge {
    background: linear-gradient(135deg, #f0b080, #b06a30);
    color: #2a1406;
}
.rank-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.25);
}
.rank-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rank-area {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.rank-bar {
    flex-basis: 120px;
    height: 5px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 5px;
    overflow: hidden;
}
.rank-bar-fill {
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, var(--accent-color), #4d88ff);
    animation: bar-grow 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes bar-grow {
    from { width: 0; }
}

/* Vue d'ensemble */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.overview-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 10px 12px;
}
.overview-card .ov-label {
    font-size: 0.64rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.overview-card .ov-value {
    font-size: 1rem;
    font-weight: 700;
    margin-top: 3px;
    color: #fff;
}
.overview-card .ov-sub {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stats-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 30px 10px;
    font-size: 0.85rem;
}

/* Comparaisons du monde réel (équivalences) */
/* Carte « % de Chambéry » mise en valeur */
.chambery-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.12), rgba(0, 243, 255, 0.03));
    border: 1px solid rgba(0, 243, 255, 0.25);
    box-shadow: 0 0 24px rgba(0, 243, 255, 0.08);
    animation: modal-pop 0.4s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}
.chambery-ico {
    font-size: 1.6rem;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 243, 255, 0.12);
    border-radius: 12px;
    flex-shrink: 0;
}
.chambery-hero b {
    font-size: 1.15rem;
    color: var(--accent-color);
    font-variant-numeric: tabular-nums;
}
.chambery-main {
    flex: 1;
    min-width: 0;
}
.chambery-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: #fff;
}
.chambery-sub {
    display: block;
    font-size: 0.74rem;
    color: var(--text-secondary);
    margin-top: 2px;
}
.chambery-track {
    display: block;
    height: 7px;
    margin-top: 9px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 7px;
    overflow: hidden;
}
.chambery-fill {
    display: block;
    height: 100%;
    border-radius: 7px;
    background: linear-gradient(90deg, var(--accent-color), #3dff9b);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
    animation: bar-grow 1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.equiv-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.equiv-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: modal-pop 0.4s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}
.equiv-ico {
    font-size: 1.4rem;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 243, 255, 0.08);
    border: 1px solid rgba(0, 243, 255, 0.12);
    border-radius: 12px;
    flex-shrink: 0;
}
.equiv-card b {
    font-size: 1.02rem;
    color: #fff;
    display: block;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.equiv-card span {
    font-size: 0.7rem;
    color: var(--text-secondary);
}
.equiv-note {
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: rgba(0, 243, 255, 0.05);
    border: 1px solid rgba(0, 243, 255, 0.1);
    border-radius: 10px;
    padding: 9px 12px;
    margin: 0;
}

/* Barres horizontales génériques */
.hbar {
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.hbar-row {
    display: grid;
    grid-template-columns: 120px 1fr 84px;
    gap: 10px;
    align-items: center;
}
.hbar-name {
    font-size: 0.74rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hbar-track {
    height: 13px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 7px;
    overflow: hidden;
}
.hbar-fill {
    height: 100%;
    border-radius: 7px;
    background: linear-gradient(90deg, var(--accent-color), #4d88ff);
    min-width: 2px;
    animation: bar-grow 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.hbar-fill-alt {
    background: linear-gradient(90deg, #b48cff, #6b4dff);
}
.hbar-fill-hist {
    background: linear-gradient(90deg, #3dff9b, #00c48f);
}
.hbar-val {
    font-size: 0.74rem;
    text-align: right;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.hbars-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

/* Statistiques descriptives */
.desc-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

/* Répartition par couleur */
.color-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.color-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.color-chip b {
    color: #fff;
    font-variant-numeric: tabular-nums;
}
.color-chip .l-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.3);
}

/* Tableau récapitulatif */
.table-scroll {
    overflow-x: auto;
}
.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    min-width: 520px;
}
.stats-table th {
    text-align: left;
    color: var(--text-secondary);
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    white-space: nowrap;
}
.stats-table td {
    padding: 7px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.stats-table tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02);
}
.stats-table .t-name {
    font-weight: 600;
    color: #fff;
}

/* Mobile : panneau plein écran, grilles resserrées */
@media (max-width: 820px) {
    /* Flou permanent réduit sur mobile : l'effet reste visible, mais le
       panning de la carte ne subit plus le coût GPU du backdrop-filter. */
    :root {
        --blur-amount: var(--blur-amount-mobile);
    }
    .stats-overlay {
        padding: 0;
        align-items: stretch;
    }
    .stats-box {
        width: 100%;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
    }
    .stats-kpis,
    .overview-grid,
    .desc-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .equiv-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .hbars-2col {
        grid-template-columns: 1fr;
    }
    .donut-wrap {
        justify-content: center;
    }
    .rank-bar {
        display: none;
    }
    .hbar-row {
        grid-template-columns: 86px 1fr 66px;
        gap: 8px;
    }
}

/* --- Localisation GPS (bouton flottant, mobile uniquement) --- */
.locate-btn {
    display: none;
    position: absolute;
    right: 16px;
    bottom: 92px;
    z-index: 1300;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(20, 24, 36, 0.98), rgba(10, 12, 18, 0.98));
    border: 1px solid rgba(0, 243, 255, 0.22);
    color: var(--text-primary);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(0, 243, 255, 0.08);
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.locate-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 0 20px rgba(0, 243, 255, 0.25);
}

.locate-btn.active {
    color: var(--accent-color);
    border-color: var(--accent-color);
    background: rgba(0, 243, 255, 0.12);
    box-shadow: 0 0 14px rgba(0, 243, 255, 0.4);
}

.locate-btn.locating {
    color: var(--accent-color);
    border-color: var(--accent-color);
    animation: pulse 1.2s infinite;
}

/* --- Responsive / Mobile --- */
@media (max-width: 820px) {
    .fingerprint-menu-item {
        display: flex;
    }
    .shortcuts-menu-item {
        display: none;
    }

    .topbar {
        /* Notch / encoche : la barre descend sous la zone de sécurité iOS */
        height: calc(54px + env(safe-area-inset-top));
        padding: env(safe-area-inset-top) 12px 0;
        gap: 10px;
    }

    .topbar-brand {
        gap: 8px;
    }

    .panel-toggle {
        display: flex;
    }

    .locate-btn {
        display: flex;
    }

    .splash-name {
        font-size: 1.5rem;
        letter-spacing: 4px;
    }

    .splash-bolt {
        width: 60px;
        height: 60px;
    }

    .topbar-name {
        display: none;
    }

    .topbar-title-mobile {
        display: block;
        font-size: 1.05rem;
        font-weight: 800;
        letter-spacing: 0.5px;
        white-space: nowrap;
        background: linear-gradient(180deg, #ffffff 35%, #b8f9ff 100%);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        flex-shrink: 0;
    }

    .topbar-stats .stat-nodes {
        display: none;
    }

    .topbar-stats {
        flex: 1 1 auto;
        min-width: 0;
        gap: 8px;
    }

    .topbar-right {
        gap: 8px;
        flex-shrink: 0;
    }

    .topbar-brand {
        flex: 0 0 auto;
    }

    .sync-refresh {
        width: 28px;
        height: 28px;
    }

    .sync-chrono {
        min-width: 22px;
        font-size: 0.68rem;
    }

    .topbar-stats {
        gap: 10px;
    }

    .stat {
        font-size: 0.7rem;
        gap: 3px;
    }

    .stat b {
        font-size: 0.95rem;
    }

    .topbar-stats .stat-photos {
        display: none;
    }

    .toast-container {
        top: calc(64px + env(safe-area-inset-top));
    }

    .topbar .layer-toggle {
        display: none;
    }

    .sat-toggle {
        display: flex;
    }

    /* Panneau en tiroir (drawer) */
    .side-panel {
        position: fixed;
        top: calc(54px + env(safe-area-inset-top));
        bottom: 0;
        left: 0;
        width: min(86vw, 330px);
        z-index: 1700;
        border-radius: 0 16px 16px 0;
        border-top: none;
        border-left: none;
        padding: 18px;
        transform: translateX(-110%);
        opacity: 1;
        pointer-events: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .side-panel.hidden {
        transform: translateX(-110%);
    }

    .side-panel.panel-open {
        transform: translateX(0);
    }

    .panel-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1650;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s;
    }

    .panel-backdrop.show {
        opacity: 1;
        visibility: visible;
    }

    .zone-list {
        max-height: none;
    }

    /* Contrôles Leaflet sous la barre compacte */
    .leaflet-top.leaflet-right {
        top: calc(64px + env(safe-area-inset-top));
    }

    /* Toast d'instruction pendant le tracé */
    .draw-hint {
        display: flex;
        flex-direction: column;
        gap: 8px;
        position: absolute;
        top: calc(62px + env(safe-area-inset-top));
        left: 50%;
        transform: translateX(-50%);
        z-index: 1400;
        width: min(420px, calc(100vw - 20px));
        background: linear-gradient(180deg, rgba(16, 20, 32, 0.97), rgba(10, 12, 18, 0.97));
        border: 1px solid rgba(0, 243, 255, 0.28);
        border-radius: 16px;
        padding: 10px 12px;
        font-size: 0.8rem;
        color: var(--text-primary);
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 243, 255, 0.08);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    .draw-hint.visible {
        opacity: 1;
        pointer-events: auto;
    }

    .create-hud-top {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-wrap: wrap;
    }

    .create-hud-main {
        display: flex;
        align-items: flex-start;
        gap: 8px;
    }

    .create-hud-text,
    .draw-hint #drawHintText {
        flex: 1;
        min-width: 0;
        line-height: 1.35;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }

    .create-hud-actions {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
    }

    .draw-hint-cancel {
        flex-shrink: 0;
        width: 34px;
        height: 34px;
        border-radius: 50%;
        border: 1px solid rgba(255, 51, 102, 0.35);
        background: rgba(255, 51, 102, 0.12);
        color: #ff8aa5;
        font-size: 0.85rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .draw-hint.hidden { display: none; }

    .draw-hint-locate {
        display: none;
        align-items: center;
        gap: 5px;
        flex-shrink: 0;
        height: 34px;
        padding: 0 10px;
        border-radius: 999px;
        border: 1px solid rgba(0, 243, 255, 0.4);
        background: rgba(0, 243, 255, 0.12);
        color: var(--accent-color);
        font-family: inherit;
        font-size: 0.72rem;
        font-weight: 700;
        cursor: pointer;
    }

    /* Viseur central (crosshair) */
    .crosshair-overlay {
        display: block;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        z-index: 1250;
        pointer-events: none;
    }
    .crosshair-overlay .crosshair-ring {
        position: absolute;
        width: 54px;
        height: 54px;
        left: -27px;
        top: -27px;
        border-radius: 50%;
        border: 1.5px solid rgba(0, 243, 255, 0.35);
        box-shadow: 0 0 18px rgba(0, 243, 255, 0.2);
    }
    .crosshair-overlay .crosshair-h,
    .crosshair-overlay .crosshair-v {
        position: absolute;
        background: rgba(0, 243, 255, 0.92);
        box-shadow: 0 0 8px rgba(0, 243, 255, 0.65);
        border-radius: 2px;
    }
    .crosshair-overlay .crosshair-h {
        width: 92px;
        height: 2px;
        left: -46px;
        top: -1px;
    }
    .crosshair-overlay .crosshair-v {
        height: 92px;
        width: 2px;
        top: -46px;
        left: -1px;
    }
    .crosshair-overlay .crosshair-dot {
        position: absolute;
        width: 14px;
        height: 14px;
        left: -7px;
        top: -7px;
        border-radius: 50%;
        background: rgba(0, 243, 255, 0.95);
        border: 2px solid #ffffff;
        box-shadow: 0 0 12px rgba(0, 243, 255, 0.95);
    }

    .crosshair-controls {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        position: absolute;
        bottom: calc(22px + env(safe-area-inset-bottom));
        left: 50%;
        transform: translateX(-50%);
        z-index: 1350;
        width: min(340px, calc(100vw - 24px));
    }
    .crosshair-meta {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 5px 12px;
        border-radius: 999px;
        background: rgba(10, 12, 18, 0.88);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: var(--text-secondary);
        font-size: 0.72rem;
        font-weight: 600;
    }
    .crosshair-meta-sep { opacity: 0.45; }
    #crosshairMetaCount { color: var(--accent-color); font-variant-numeric: tabular-nums; }
    .crosshair-btns {
        display: flex;
        align-items: flex-end;
        justify-content: center;
        gap: 14px;
        width: 100%;
    }
    .crosshair-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        width: 64px;
        height: 64px;
        border-radius: 18px;
        border: 1px solid rgba(255, 255, 255, 0.14);
        background: rgba(14, 16, 24, 0.94);
        color: var(--text-primary);
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        font-family: inherit;
    }
    .crosshair-btn-label {
        font-size: 0.65rem;
        font-weight: 700;
        letter-spacing: 0.02em;
    }
    .crosshair-btn:active { transform: scale(0.92); }
    .crosshair-btn.undo {
        width: 56px;
        height: 56px;
        color: #ff8aa5;
        border-color: rgba(255, 51, 102, 0.35);
        background: rgba(255, 51, 102, 0.1);
    }
    .crosshair-btn.add {
        width: 76px;
        height: 76px;
        border-radius: 22px;
        color: #061018;
        background: linear-gradient(180deg, #5ef7ff, #00d6e0);
        border-color: transparent;
        box-shadow: 0 0 28px rgba(0, 243, 255, 0.45);
    }
    .crosshair-btn.add .crosshair-btn-label { color: #061018; }
    .crosshair-btn.finish {
        width: 56px;
        height: 56px;
        color: #00ff9d;
        border-color: rgba(0, 255, 157, 0.45);
        background: rgba(0, 255, 157, 0.12);
    }
    .crosshair-overlay.hidden,
    .crosshair-controls.hidden { display: none !important; }

    .locate-btn {
        bottom: calc(118px + env(safe-area-inset-bottom));
    }

    /* Modal édition = bottom sheet */
    .floating-menu {
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: 100%;
        max-height: min(88dvh, 720px);
        border-radius: 18px 18px 0 0;
        transform: none !important;
        padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
    }
    .floating-menu.hidden {
        transform: translateY(110%) !important;
    }

    .edit-bar {
        width: calc(100vw - 16px);
        max-width: 520px;
        bottom: calc(10px + env(safe-area-inset-bottom));
        border-radius: 18px;
        padding: 10px 8px 12px;
    }
    .edit-bar-btn {
        flex: 1;
        min-width: 0;
        padding: 10px 4px;
        font-size: 0.62rem;
    }
    .edit-bar-actions,
    .edit-bar-tools,
    .edit-bar-footer {
        width: 100%;
    }
}

/* --- Mode « Modifier le tracé » --- */
.edit-polygon {
    filter: drop-shadow(0 0 6px rgba(0, 243, 255, 0.35));
}

.vertex-handle {
    border: 2px solid #fff !important;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.6), 0 0 10px rgba(255, 255, 255, 0.25);
    pointer-events: none;
}

/* Cible invisible des sommets : large, elle capte le doigt / la souris */
.vertex-hit {
    touch-action: none;
    cursor: grab;
}

.vertex-hit:active { cursor: grabbing; }

.snap-ghost {
    box-shadow: 0 0 8px rgba(0, 243, 255, 0.8);
}

/* Points d'attache en édition : losange (distinct des sommets ronds) + cible */
.anchor-icon {
    pointer-events: none;
}
.anchor-diamond {
    width: 13px;
    height: 13px;
    transform: rotate(45deg);
    border: 2px solid #fff;
    border-radius: 3px;
}
.anchor-hit {
    touch-action: none;
    cursor: grab;
}
.anchor-hit:active { cursor: grabbing; }
.anchor-hit-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.02);
}

/* Marqueur « panneau repéré » : plaque carrée avec un P */
.panel-marker {
    pointer-events: none;
}
.panel-sign {
    width: 15px;
    height: 15px;
    border-radius: 3px;
    border: 2px solid;
    background: rgba(10, 12, 18, 0.75);
    font-size: 9px;
    font-weight: 800;
    line-height: 13px;
    text-align: center;
}

/* Marqueur « infrastructure supposée » : anneau en tirets avec un ? */
.supposed-marker {
    pointer-events: none;
}
.supposed-ring {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px dashed;
    background: rgba(10, 12, 18, 0.5);
    font-size: 9px;
    font-weight: 800;
    line-height: 12px;
    text-align: center;
}

/* Tracé d'une zone supposée : contour pointillé très clair, rempli fantôme */
.supposed-polygon {
    fill-opacity: 0.06;
    filter: drop-shadow(0 0 2px rgba(255, 209, 102, 0.35));
}

/* Sous-libellé des KPI du panneau admin */
.admin-kpi .kpi-sub {
    font-size: 0.68rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.edit-bar {
    position: absolute;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%) translateY(140%);
    z-index: 1400;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: max-content;
    max-width: calc(100vw - 20px);
    background: linear-gradient(180deg, rgba(18, 22, 34, 0.98), rgba(10, 12, 18, 0.98));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 243, 255, 0.35);
    border-radius: 16px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55), 0 0 24px rgba(0, 243, 255, 0.08);
    padding: 10px 12px 12px;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s ease;
    opacity: 0;
    pointer-events: none;
}

.edit-bar.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.edit-bar-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.edit-bar-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-color);
    text-align: center;
}

.edit-bar-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.edit-bar-tools {
    padding-bottom: 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.edit-bar-footer { padding-top: 2px; }

.edit-bar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 52px;
    padding: 8px 8px;
    border-radius: 11px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.edit-bar-btn-text { line-height: 1; }

.edit-bar-btn:hover { background: rgba(255, 255, 255, 0.15); }

.edit-bar-btn.active {
    background: rgba(255, 51, 102, 0.18);
    border-color: var(--danger-color);
    color: #ff7b96;
}

.edit-bar-btn.on {
    background: rgba(0, 243, 255, 0.14);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.edit-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.edit-stats span:nth-child(even) { opacity: 0.5; }

.edit-bar-btn:disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.edit-bar-btn.edit-bar-save {
    background: rgba(0, 243, 255, 0.16);
    border-color: var(--accent-color);
    color: var(--accent-color);
    min-width: 64px;
}

.edit-bar-btn.edit-bar-cancel {
    background: rgba(255, 51, 102, 0.1);
    border-color: rgba(255, 51, 102, 0.5);
    color: var(--danger-color);
}

/* --- Dialogue de chevauchement --- */
.overlap-box { border-color: rgba(0, 243, 255, 0.45); }

.overlap-icon {
    color: var(--accent-color);
    filter: drop-shadow(0 0 8px rgba(0, 243, 255, 0.5));
}

.overlap-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.overlap-opt {
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    text-align: left;
    align-items: flex-start;
}

.overlap-opt span {
    font-weight: 400;
    font-size: 0.75rem;
    opacity: 0.75;
    line-height: 1.35;
}

@media (max-width: 820px) {
    /* Les champs de saisie doivent rester ≥ 16px sinon iOS zoome au focus */
    .custom-input, .zone-filter, .small-input, .desc-input {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .topbar-stats {
        gap: 8px;
    }

    .stat {
        font-size: 0.64rem;
        gap: 2px;
    }

    .stat b {
        font-size: 0.85rem;
    }

    /* Cibles tactiles confortables même sur petit écran */
    .menu-btn {
        width: 40px;
        height: 40px;
    }

    .panel-toggle {
        width: 40px;
        height: 40px;
    }

    .login-container {
        width: calc(100vw - 40px);
        padding: 28px 20px;
        max-height: calc(100dvh - 24px);
        overflow-y: auto;
    }


    .locate-btn {
        bottom: calc(92px + env(safe-area-inset-bottom));
    }

    .gallery-btn {
        width: 38px;
        height: 38px;
    }

    .gallery-prev {
        left: 10px;
    }

    .gallery-next {
        right: 10px;
    }
}

@media (max-width: 420px) {
    .topbar-brand {
        gap: 6px;
    }

    .topbar-title-mobile {
        font-size: 0.98rem;
    }

    .topbar-right {
        gap: 6px;
    }

    .topbar-stats .stat-zones {
        display: none;
    }

    .menu-btn {
        width: 40px;
        height: 40px;
    }

    .panel-toggle {
        width: 40px;
        height: 40px;
    }
}

/* --- Panneau Données (accès administrateur) --- */
.admin-login-box { max-width: 420px; }
.admin-panel-box { max-width: 880px; max-height: 92vh; overflow-y: auto; }
.admin-delete-box { max-width: 460px; }

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}
.admin-form .small-btn {
    align-self: flex-end;
    margin-top: 6px;
    min-width: 140px;
}

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin: 14px 0 4px;
}
.admin-kpi {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 12px;
    padding: 10px 12px;
}
.admin-kpi .kpi-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}
.admin-kpi .kpi-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--accent-color);
    margin-top: 2px;
    line-height: 1.15;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}
.admin-danger {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px dashed rgba(255, 77, 109, 0.35);
}
.admin-danger-note {
    font-size: 0.72rem;
    color: var(--text-secondary);
    opacity: 0.75;
    line-height: 1.35;
}
.admin-table-scroll {
    max-height: 300px;
    margin-top: 14px;
}

.admin-delete-icon { color: #ff4d6d; }
.admin-delete-title {
    color: #ff4d6d;
    margin-top: 10px;
}
.admin-delete-msg {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 8px 0 2px;
}
.admin-delete-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

@media (max-width: 820px) {
    .admin-panel-box {
        max-height: 94vh;
        max-width: 100vw;
        width: 100%;
    }
    .admin-overview {
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
        gap: 8px;
    }
    .admin-header-actions .btn {
        display: none; /* la fermeture de session reste dispo dans le menu ⋯ */
    }
}

/* --- Polish final : ambiance carte + reduced motion --- */
#map::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 250; /* au-dessus des tuiles, sous les marqueurs/polygones Leaflet */
    pointer-events: none;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(0, 243, 255, 0.05), transparent 42%),
        radial-gradient(ellipse at 50% 100%, rgba(0, 0, 0, 0.28), transparent 55%);
}

.leaflet-control-zoom a {
    border-radius: 10px !important;
}

.fp-login-btn {
    box-shadow: 0 0 18px rgba(0, 243, 255, 0.08);
}

.fp-login-btn:hover {
    box-shadow: 0 0 22px rgba(0, 243, 255, 0.22);
}

@media (prefers-reduced-motion: reduce) {
    .login-orb,
    .status-indicator,
    .splash-glow,
    .neon-icon .bolt-energy {
        animation: none !important;
    }
}

@media (max-width: 820px) {
    .status-indicator {
        animation: none;
    }
    .login-orb {
        opacity: 0.35;
        filter: blur(28px);
    }
}

/* --- Récap avant validation (bottom sheet) --- */
.create-recap-scrim {
    position: fixed;
    inset: 0;
    z-index: 7500;
    background: rgba(5, 5, 8, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}
.create-recap-scrim.open {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}
.create-recap-sheet {
    width: min(440px, 100%);
    border-radius: 20px 20px 0 0;
    padding: 12px 18px calc(18px + env(safe-area-inset-bottom));
    transform: translateY(110%);
    transition: transform 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.15);
    border: 1px solid rgba(0, 243, 255, 0.28);
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.55);
    background: rgba(12, 16, 26, 0.96);
}
.create-recap-scrim.open .create-recap-sheet {
    transform: translateY(0);
}
.create-recap-handle {
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    margin: 2px auto 14px;
}
.create-recap-title {
    margin: 0 0 6px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}
.create-recap-sub {
    margin: 0 0 16px;
    font-size: 0.88rem;
    line-height: 1.4;
    color: var(--text-secondary);
}
.create-recap-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.create-recap-stat {
    text-align: center;
    padding: 12px 8px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.create-recap-stat b {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-color);
    font-variant-numeric: tabular-nums;
}
.create-recap-stat span {
    font-size: 0.7rem;
    color: var(--text-secondary);
}
.create-recap-actions {
    display: flex;
    gap: 10px;
}
.create-recap-actions .btn {
    flex: 1;
    min-height: 44px;
}
@media (min-width: 821px) {
    .create-recap-scrim {
        align-items: center;
    }
    .create-recap-sheet {
        border-radius: 18px;
        transform: translateY(12px) scale(0.98);
        opacity: 0;
        transition: transform 0.22s ease, opacity 0.2s ease;
    }
    .create-recap-scrim.open .create-recap-sheet {
        transform: none;
        opacity: 1;
    }
    .create-recap-handle { display: none; }
}

/* Édition mobile : 4 outils + Plus */
.edit-bar .edit-bar-extra.edit-bar-actions {
    display: none;
    flex-wrap: wrap;
    width: 100%;
    gap: 6px;
    justify-content: center;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.edit-bar.expert .edit-bar-extra.edit-bar-actions {
    display: flex;
}
.edit-bar-btn.edit-bar-more.on {
    background: rgba(0, 243, 255, 0.18);
    border-color: rgba(0, 243, 255, 0.45);
    color: var(--accent-color);
}
@media (min-width: 821px) {
    .edit-bar .edit-bar-extra.edit-bar-actions {
        display: flex;
        border-top: none;
        padding-top: 0;
    }
    .edit-bar-btn.edit-bar-more { display: none; }
}

/* Transitions création / édition */
body.mode-creating #uiPanel:not(.panel-open),
body.mode-editing #uiPanel:not(.panel-open) {
    pointer-events: none;
}
@media (max-width: 820px) {
    .draw-hint {
        transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.15);
    }
    .draw-hint:not(.visible) {
        transform: translateX(-50%) translateY(-8px);
    }
    .draw-hint.visible {
        transform: translateX(-50%) translateY(0);
    }
}
