.cnm-card {
    --cnm-height: 850px;
    box-sizing: border-box;
    max-width: 1500px;
    margin: 1.5em auto;
    border: 1px solid #dfe3e8;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: #1b2430;
}
.cnm-card * { box-sizing: border-box; }

.cnm-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1em;
    padding: 1em 1.25em;
    background: linear-gradient(135deg, #17223b, #223558);
    color: #fff;
}
.cnm-kicker {
    margin: 0 0 .25em;
    font-size: .72rem;
    letter-spacing: .06em;
    color: #9fb3d9;
    font-weight: 600;
}
.cnm-header h2 { margin: 0; font-size: 1.25rem; }
.cnm-meta { margin: .3em 0 0; font-size: .82rem; color: #cbd6ec; }
.cnm-badge {
    flex-shrink: 0;
    text-align: center;
    background: rgba(255,255,255,.12);
    border-radius: 8px;
    padding: .4em .7em;
    font-size: .72rem;
    line-height: 1.3;
}
.cnm-badge strong { font-size: .95rem; }

.cnm-detail {
    padding: 1em 1.25em;
    background: #fff;
    border-bottom: 1px solid #e2e6ec;
}
.cnm-detail[hidden] { display: none; }
.cnm-detail-back {
    border: 1px solid #d3dae4;
    background: #f4f6f9;
    border-radius: 6px;
    padding: .35em .8em;
    font-size: .8rem;
    cursor: pointer;
    color: #33465f;
    margin-bottom: .8em;
}
.cnm-detail-title { display: flex; align-items: center; gap: .6em; margin: 0 0 .4em; font-size: 1.15rem; }
.cnm-detail-dot { width: .8em; height: .8em; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.cnm-detail-meta { display: flex; flex-wrap: wrap; gap: .4em 1.2em; font-size: .85rem; color: #5a6779; margin: 0 0 .6em; }
.cnm-detail-meta strong { color: #1b2430; }
.cnm-detail-link {
    display: inline-block;
    margin-top: .3em;
    padding: .4em .9em;
    background: #1b2430;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-size: .82rem;
}
.cnm-detail-link:hover { background: #33465f; }
.cnm-detail-missing { color: #a4222c; font-size: .9rem; }

.cnm-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .35em;
    padding: .6em 1.25em;
    background: #f4f6f9;
    border-bottom: 1px solid #e2e6ec;
    max-height: 6.5em;
    overflow-y: auto;
}
.cnm-toolbar button {
    border: 1px solid #d3dae4;
    background: #fff;
    border-radius: 999px;
    padding: .3em .8em;
    font-size: .76rem;
    cursor: pointer;
    color: #33465f;
    display: inline-flex;
    align-items: center;
    gap: .4em;
    white-space: nowrap;
}
.cnm-toolbar button.is-active {
    background: #1b2430;
    color: #fff;
    border-color: #1b2430;
}
.cnm-toolbar button.is-empty {
    opacity: .45;
}
.cnm-toolbar button.cnm-toolbar-all {
    font-weight: 700;
}
.cnm-toolbar .cnm-dot {
    width: .55em;
    height: .55em;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.cnm-toolbar .cnm-count {
    opacity: .75;
    font-size: .72em;
}

/*
 * Leaflet applique une transformation CSS (transform) sur son conteneur
 * interne de panneaux (.leaflet-map-pane), ce qui crée un nouveau contexte
 * d'empilement : un z-index posé sur .leaflet-popup-pane (à l'intérieur)
 * ne peut donc jamais rivaliser avec des éléments EXTÉRIEURS à la carte,
 * comme un menu du thème en position:fixed avec un z-index élevé. Il faut
 * élever le CONTENEUR EXTÉRIEUR (.cnm-viewport) pour que la carte entière
 * (popups comprises) passe au-dessus d'un menu collant du thème.
 */
.cnm-viewport {
    position: relative;
    z-index: 10060;
    height: var(--cnm-height);
    background: #cfe0f0;
}
.cnm-map { width: 100%; height: 100%; }

.cnm-map-brand {
    position: absolute;
    right: .6em;
    bottom: .5em;
    z-index: 500;
    background: rgba(255,255,255,.9);
    border-radius: 6px;
    padding: .2em .5em;
    font-size: .68rem;
    color: #33465f;
    text-decoration: none;
}

.cnm-fullscreen-btn {
    position: absolute;
    top: .6em;
    right: .6em;
    z-index: 650;
    width: 2.2em;
    height: 2.2em;
    border: 1px solid #d3dae4;
    border-radius: 6px;
    background: rgba(255,255,255,.92);
    color: #1b2430;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cnm-fullscreen-btn:hover { background: #fff; }

.cnm-viewport:fullscreen {
    height: 100vh;
}
.cnm-viewport:fullscreen .cnm-map {
    height: 100%;
}
.cnm-viewport:-webkit-full-screen {
    height: 100vh;
}
.cnm-viewport:-webkit-full-screen .cnm-map {
    height: 100%;
}

.cnm-loading, .cnm-error {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.85);
    font-size: .9rem;
    color: #33465f;
    z-index: 600;
}
.cnm-error { color: #a4222c; }
.cnm-loading[hidden], .cnm-error[hidden] { display: none; }

.cnm-footer {
    display: flex;
    flex-wrap: wrap;
    gap: .3em 1em;
    justify-content: space-between;
    padding: .6em 1.25em;
    font-size: .74rem;
    color: #5a6779;
    background: #f4f6f9;
    border-top: 1px solid #e2e6ec;
}
.cnm-footer a { color: #33608f; }

.cnm-cluster-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    font-size: .85rem;
    border: 2px solid rgba(255,255,255,.85);
    box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.cnm-cluster-small { background: #4caf50; }
.cnm-cluster-medium { background: #e6a817; }
.cnm-cluster-large { background: #e05a2b; }

.cnm-popup { font-size: .85rem; line-height: 1.4; }
.cnm-popup strong { display: block; margin-bottom: .2em; }

.cnm-message.cnm-error-message { padding: 1em 1.25em; color: #a4222c; }
