/* #287 : un seul accent (--c-brand : états actifs, action principale, focus) ; tout le reste en neutres. */
.ce-scene, .ce-fiche, .ce-sous { --ce-accent: var(--c-brand, #3D5A73); --ce-accent-fort: var(--c-brand-hover, #2E465B); --ce-ink: var(--c-text, #0F172A); --ce-muted: var(--c-text-2, #475569); --ce-line: var(--c-border, #E2E8F0); --ce-hover: #F1F5F9; }
/* Carte économique interactive 2026 (core/templates/core/carte_eco/carte.html) — jetons du socle (frontend/socle/jetons.css).
   #265 : la carte d'abord. Scène = panneau (340 px, escamotable) + carte ; en dessous de 768 px le panneau devient un tiroir
   à 3 positions (replié, mi-hauteur, plein). Légende, chronologie et étiquettes flottent sur la carte, outils sur le bord droit. */
.ce-pastille { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(15, 23, 42, .35); }
.ce-pastille--zone { border-radius: 2px; }
.ce-nb { color: var(--c-text-2); font-variant-numeric: tabular-nums; }
.ce-legendes { margin-top: var(--s-2, 12px); min-width: 0; display: grid; gap: var(--s-2, 12px); }
.ce-legende__titre { margin: 0; font: var(--t-compact); font-weight: 600; color: var(--c-text); }
.ce-legendes .ui-source { overflow-wrap: anywhere; }
.ce-tableau { margin-top: var(--s-2, 12px); }
.ce-tableau .ui-table__cadre { max-height: 480px; overflow: auto; }
.ce-tableau caption { text-align: left; font-weight: 600; padding: 8px 0; }
.ce-tableau .est-annee { background: var(--c-brand-soft, #E6EDF3); font-weight: 600; }
.ce-attente { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 12px; background: var(--c-bg-2); }
.ce-attente p { margin: 0; font: var(--t-compact); color: var(--c-text-2); }
.ce-attente svg, .ce-attente__img { width: 100%; height: auto; max-height: calc(100% - 32px); object-fit: contain; }
.ce-attente__img { flex: 1 1 auto; min-height: 0; }

/* ---- page : titre sur une ligne (hauteur fixe), scène à la hauteur de l'écran sous l'en-tête du site */
:root { --ce-tete-h: 72px; }
@media (min-width: 640px) { :root { --ce-tete-h: 52px; } }
.pc--carte { padding: 0; }
.ce-tete { display: flex; align-items: center; justify-content: space-between; gap: 0 16px; flex-wrap: wrap; align-content: center; height: var(--ce-tete-h); max-width: 1920px; width: 100%; margin: 0 auto; padding: 0 var(--marge-page, 16px); box-sizing: border-box; min-width: 0; overflow: hidden; }
.ce-h1 { margin: 0; font: 700 1.25rem/1.3 var(--f-titre, inherit); color: var(--c-text, #0F172A); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (min-width: 1024px) { .ce-h1 { font-size: 1.5rem; } }
.ce-tete .ui-breadcrumb { margin: 0; min-width: 0; max-width: 100%; }
.ce-tete .ui-breadcrumb ol { margin: 0; padding: 0; flex-wrap: nowrap; overflow: hidden; white-space: nowrap; font-size: .8125rem; }
.ce-scene { position: relative; height: calc(100vh - var(--entete-h, 64px) - var(--ce-tete-h)); height: calc(100svh - var(--entete-h, 64px) - var(--ce-tete-h)); min-height: 440px; display: grid; grid-template-columns: 340px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); border-top: 1px solid var(--c-border, #CBD5E1); overflow: hidden; background: var(--c-bg-2, #F1F5F9); }
.ce-scene--replie { grid-template-columns: 0 minmax(0, 1fr); }
@media (prefers-reduced-motion: no-preference) { .ce-scene { transition: grid-template-columns .2s ease; } }
.ce-carte { position: relative; isolation: isolate; margin: 0; min-width: 0; min-height: 0; grid-column: 2; grid-row: 1; }
.ce-carte .ce-carte__cadre { position: absolute; inset: 0; height: 100%; width: 100%; }
.ce-carte .leaflet-container { font: inherit; }
.ce-carte .leaflet-bar a, .ce-carte .leaflet-touch .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; font-size: 22px; }
.ce-carte .leaflet-top.leaflet-left { top: 4px; }
.ce-btn-icone:focus-visible, .ce-btn:focus-visible, .ce-chip__x:focus-visible, .ce-tout:focus-visible, .ce-barre__btn:focus-visible, .ce-info:focus-visible, .ce-flot__tete:focus-visible,
.ce-poignee:focus-visible, .ce-parcours__btn:focus-visible, .ce-champ:focus-visible, .ce-theme > summary:focus-visible, .ce-couche:has(input:focus-visible), .ce-chrono__annees button:focus-visible,
.ce-chrono__case:has(input:focus-visible), .ce-chrono input[type=range]:focus-visible { outline: 3px solid var(--ui-focus, #0052A3); outline-offset: 2px; }

/* ---- panneau latéral */
.ce-panneau { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--c-bg, #fff); border-right: 1px solid var(--c-border, #CBD5E1); width: 340px; box-sizing: border-box; }
.ce-panneau.est-ferme { visibility: hidden; }
.ce-poignee { display: none; }
.ce-panneau__tete { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 4px 16px; border-bottom: 1px solid var(--c-border, #CBD5E1); background: var(--c-bg-2, #F1F5F9); }
.ce-panneau__titre { margin: 0; font-size: 1.0625rem; line-height: 1.3; color: var(--c-text, #0F172A); }
.ce-panneau__n { margin: 0; font: var(--t-compact); color: var(--c-text-2, #475569); }
.ce-panneau__n:empty { display: none; }
.ce-btn-icone { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--r-md, 8px); background: transparent; color: var(--c-text, #0F172A); cursor: pointer; }
.ce-btn-icone:hover { background: rgba(15, 23, 42, .08); }
.ce-panneau__corps { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px 16px 24px; display: grid; gap: 16px; align-content: start; }
.ce-panneau__corps > form { display: grid; gap: 16px; min-width: 0; }
.ce-bloc { min-width: 0; }
.ce-bloc__titre { margin: 0 0 8px; font-size: .9375rem; line-height: 1.3; font-weight: 700; color: var(--c-text, #0F172A); }
.ce-bloc__titre label { font: inherit; }
.ce-aide { margin: 6px 0 0; font: var(--t-compact); color: var(--c-text-2, #475569); }
.ce-etiquette { display: block; margin-bottom: 4px; font: var(--t-compact); font-weight: 700; color: var(--c-text, #0F172A); }
.ce-champ { box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid #64748B; border-radius: 6px; background: var(--c-bg, #fff); color: var(--c-text, #0F172A); font: inherit; font-size: 1rem; }
.ce-champ--court { width: auto; min-width: 5.5rem; }
.ce-rech__ligne { display: flex; gap: 8px; }
.ce-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; min-width: 44px; padding: 8px 14px; box-sizing: border-box; border: 1px solid var(--ce-ink); border-radius: 6px; background: var(--c-bg, #fff); color: var(--ce-ink); font: inherit; font-size: .9375rem; font-weight: 600; cursor: pointer; }
.ce-btn:hover { background: var(--ce-hover); }
.ce-btn--plein { background: var(--ce-accent); border-color: var(--ce-accent); color: #fff; }
.ce-btn--plein:hover { background: var(--ce-accent-fort); }
.ce-theme { border-top: 1px solid var(--c-border, #CBD5E1); }
.ce-theme:last-of-type { border-bottom: 1px solid var(--c-border, #CBD5E1); }
.ce-theme > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; cursor: pointer; font-weight: 600; color: var(--c-text, #0F172A); }
.ce-theme__n { min-width: 3.5em; text-align: right; font: var(--t-compact); font-variant-numeric: tabular-nums; color: var(--c-text-2, #475569); }
.ce-theme__n.est-actif { color: var(--ce-accent); font-weight: 700; }
.ce-couches { margin: 0; padding: 0 0 8px; list-style: none; }
.ce-couches li[hidden] { display: none; }
.ce-couche { position: relative; display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font: var(--t-compact); color: var(--c-text-body, #1E293B); overflow-wrap: anywhere; }
.ce-sw__in { position: absolute; left: 0; top: 50%; width: 40px; height: 24px; margin: -12px 0 0; opacity: 0; cursor: pointer; }
.ce-sw { flex: none; position: relative; width: 40px; height: 24px; border-radius: 12px; background: #64748B; transition: background .15s; }
.ce-sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.ce-sw__in:checked + .ce-sw { background: #3D5A73; }
.ce-sw__in:checked + .ce-sw::after { transform: translateX(16px); }
@media (prefers-reduced-motion: reduce) { .ce-sw, .ce-sw::after { transition: none; } }

/* ---- éléments flottants sur la carte */
.ce-haut { position: absolute; z-index: 600; top: 8px; left: 56px; right: 64px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; pointer-events: none; min-width: 0; }
.ce-haut > * { pointer-events: auto; }
.ce-btn--flot { box-shadow: 0 1px 6px rgba(15, 23, 42, .3); }
.ce-btn--flot[aria-expanded="true"] { display: none; }
.ce-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: 100%; max-height: 104px; overflow-y: auto; padding: 2px; }
.ce-chips[hidden] { display: none; }
.ce-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 0 0 10px; box-sizing: border-box; border: 1px solid #94A3B8; border-radius: 9999px; background: #fff; color: var(--c-text, #0F172A); font: var(--t-compact); font-weight: 600; box-shadow: 0 1px 4px rgba(15, 23, 42, .25); max-width: 100%; }
.ce-chip__nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.ce-chip__x { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -4px 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.ce-chip__x:hover { background: rgba(15, 23, 42, .1); }
.ce-chip--tout { min-height: 44px; padding: 0 14px; border-style: dashed; cursor: pointer; background: #fff; }
.ce-conseil { margin: 0; max-width: 34rem; padding: 8px 12px; border-radius: 8px; border-left: 4px solid var(--ce-accent); background: #fff; color: var(--ce-ink); font: var(--t-compact); box-shadow: 0 1px 4px rgba(15, 23, 42, .2); }
.ce-barre { position: absolute; z-index: 610; top: 8px; right: 8px; display: flex; flex-direction: column; flex-wrap: wrap; gap: 4px; max-height: calc(100% - 16px); padding: 4px; border-radius: 10px; background: #fff; box-shadow: 0 1px 8px rgba(15, 23, 42, .35); }
.ce-barre__btn { width: 44px; height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 8px; background: transparent; color: var(--ce-ink); cursor: pointer; }
.ce-barre__btn:hover { background: var(--ce-hover); }
.ce-barre__btn[aria-busy="true"] { opacity: .55; cursor: progress; }
.ce-bas { position: absolute; z-index: 600; left: 8px; right: 8px; bottom: 24px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; pointer-events: none; min-width: 0; }
.ce-bas > * { pointer-events: auto; max-width: 100%; box-sizing: border-box; }
.ce-flot { width: 300px; max-width: 100%; border-radius: 10px; background: rgba(255, 255, 255, .97); box-shadow: 0 1px 8px rgba(15, 23, 42, .35); font: var(--t-compact); color: var(--c-text-body, #1E293B); }
.ce-flot[hidden], .ce-chrono[hidden] { display: none; }
.ce-flot__tete { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; padding: 0 12px; border: 0; background: transparent; color: var(--c-text, #0F172A); font: inherit; font-weight: 700; cursor: pointer; }
.ce-flot__tete svg { transition: transform .15s; }
.ce-flot.est-replie .ce-flot__tete svg { transform: rotate(180deg); }
.ce-flot__corps { max-height: min(26vh, 260px); overflow-y: auto; padding: 0 12px 8px; }
.ce-flot__corps[hidden] { display: none; }
.ce-flot__bloc { padding: 6px 0; border-top: 1px solid var(--c-border, #E2E8F0); }
.ce-flot__bloc:first-child { border-top: 0; }
.ce-flot__titre { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-weight: 600; color: var(--c-text, #0F172A); overflow-wrap: anywhere; }
.ce-flot__note { margin: 4px 0 0; color: var(--c-text-2, #475569); }
.ce-flot .ui-map__legende { margin: 4px 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.ce-flot .ui-map__legende li { display: flex; align-items: center; gap: 8px; }
.ce-flot .ui-map__legende i { flex: none; width: 18px; height: 12px; border-radius: 2px; border: 1px solid rgba(15, 23, 42, .25); }
.ce-info { flex: none; margin: -10px -12px -10px auto; width: 44px; height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: transparent; color: var(--ce-muted); font: italic 700 1.125rem Georgia, serif; cursor: pointer; }
.ce-info:hover, .ce-info[aria-expanded="true"] { background: var(--ce-hover); }
.ce-info__txt { margin: 4px 0 0; overflow-wrap: anywhere; }
.ce-info__txt[hidden] { display: none; }
.ce-chrono { width: 100%; padding: 4px 12px 6px; border-radius: 10px; background: rgba(255, 255, 255, .97); box-shadow: 0 1px 8px rgba(15, 23, 42, .35); font: var(--t-compact); color: var(--c-text-body, #1E293B); }
.ce-chrono__ligne { display: flex; align-items: center; gap: 4px; }
.ce-chrono__titre { flex: none; font-weight: 700; color: var(--c-text, #0F172A); margin-right: 4px; }
.ce-chrono__curseur { flex: 1 1 auto; min-width: 0; min-height: 44px; margin: 0 4px; accent-color: #3D5A73; }
.ce-chrono__an { flex: none; min-width: 3.2em; font-weight: 700; font-size: 1.125rem; text-align: right; font-variant-numeric: tabular-nums; color: var(--c-text, #0F172A); }
.ce-chrono__play .i-pause { display: none; }
.ce-chrono__play.est-lecture .i-pause { display: block; }
.ce-chrono__play.est-lecture .i-play { display: none; }
.ce-chrono__annees { display: none; margin: 0; padding: 0; list-style: none; }
.ce-chrono__annees li { flex: 1 1 0; min-width: 0; }
.ce-chrono__annees button { width: 100%; min-height: 44px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; font-variant-numeric: tabular-nums; cursor: pointer; }
.ce-chrono__annees button:hover { background: var(--ce-hover); }
.ce-chrono__annees button.est-courant { background: var(--ce-accent); color: #fff; font-weight: 700; }
.ce-chrono__annees button.est-base { box-shadow: inset 0 0 0 2px #8C510A; }
.ce-chrono__bas { display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; }
.ce-chrono__annees { flex: 1 1 340px; }
.ce-chrono__evo { flex: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ce-chrono__evo select:disabled { display: none; }
.ce-chrono__case { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; font-weight: 600; }
.ce-chrono__case input { width: 22px; height: 22px; margin: 0; accent-color: #3D5A73; }
@media (min-width: 640px) { .ce-chrono__annees { display: flex; } }
.ce-sous { padding-top: var(--s-4, 24px); }
.ce-sous__tete { margin-bottom: var(--s-3, 16px); }

.ce-sr-seul { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Aperçu dans « Chiffres clés » : l'image fixe, en lien vers la page de la carte */
.ce-apercu__lien { display: grid; gap: var(--s-2, 12px); justify-items: start; text-decoration: none; color: inherit; }
.ce-apercu__cadre { display: block; width: 100%; aspect-ratio: 918 / 500; padding: 8px; box-sizing: border-box; border: 1px solid var(--c-border); border-radius: var(--r-md, 8px); background: var(--c-bg-2); }
.ce-apercu__svg { display: block; width: 100%; height: 100%; }
.ce-apercu__lien:hover .ce-apercu__cadre { border-color: var(--c-brand); }
.ce-apercu__lien:focus-visible { outline: 2px solid var(--ui-focus, #0052A3); outline-offset: 4px; border-radius: var(--r-md, 8px); }
.ce-apercu__legende { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: var(--s-2, 12px) 0 0; padding: 0; list-style: none; font: var(--t-compact); color: var(--c-text-body); }
.ce-apercu__legende li { display: flex; align-items: center; gap: 8px; }


/* outils ouverts : étiquettes, légende et chronologie se rangent à gauche du panneau des outils ; sur mobile le tiroir des outils les recouvre */
@media (min-width: 768px) {
    .ce-carte--outils .ce-haut { right: calc(64px + min(380px, 100% - 72px) + 8px); }
    .ce-carte--outils .ce-bas { right: calc(64px + min(380px, 100% - 72px) + 8px); }
}
@media (max-width: 767.98px) { .ce-carte--outils .ce-bas, .ce-carte--outils .ce-haut { display: none; } .ce-tete .ui-breadcrumb li::before { display: none; } }


/* ---- pastilles de pictogramme (couches, légende, étiquettes, repères, fiches) : un sprite SVG, une couleur par famille */
.ce-bdg { flex: none; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; width: var(--px, 24px); height: var(--px, 24px); border-radius: 50%; background: var(--fam, #334155); color: #fff; }
.ce-bdg svg { width: 62%; height: 62%; fill: currentColor; }
.ce-picto { display: flex; align-items: center; justify-content: center; background: transparent; border: 0; }
.ce-picto .ce-bdg { border: 2px solid #fff; box-shadow: 0 1px 4px rgba(15, 23, 42, .5); transition: transform .12s; }
.ce-picto:hover .ce-bdg, .ce-picto:focus-visible .ce-bdg { transform: scale(1.14); }
.ce-picto:focus-visible { outline: 0; }
.ce-picto:focus-visible .ce-bdg { box-shadow: 0 0 0 3px var(--ui-focus, #0052A3), 0 1px 4px rgba(15, 23, 42, .5); }
.ce-picto--cluster span { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; box-sizing: border-box; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(15, 23, 42, .45); color: #fff; font: 700 14px/1 var(--font-sans, system-ui, sans-serif); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .ce-picto .ce-bdg { transition: none; } }
.ce-types { margin: 4px 0 6px; padding: 0; list-style: none; display: grid; gap: 4px; }
.ce-types li { display: flex; align-items: center; gap: 8px; }
.ce-types__nom { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }

/* ---- panneau : en-tête, compteur, parcours en cartes, groupes repliables */
.ce-panneau__tete { background: var(--c-bg, #fff); padding: 8px 4px 8px 16px; }
.ce-panneau__ident { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.ce-panneau__titre { font-size: 1.125rem; font-weight: 700; }
.ce-panneau__n { padding: 2px 10px; border-radius: 9999px; background: var(--ce-hover); color: var(--ce-ink); font-size: .8125rem; font-weight: 600; }
.ce-btn--discret { min-height: 44px; padding: 0 8px; border: 0; background: transparent; color: var(--ce-accent); text-decoration: underline; text-underline-offset: 3px; font-size: .875rem; }
.ce-btn--discret:hover { background: var(--ce-hover); }
.ce-btn--discret[hidden] { display: none; }
.ce-panneau__corps { gap: 20px; }
.ce-bloc__titre { font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ce-muted); }
.ce-parcours { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.ce-parcours__btn { position: relative; display: grid; gap: 2px; width: 100%; min-height: 64px; padding: 12px 36px 12px 14px; box-sizing: border-box; border: 1px solid var(--ce-line); border-radius: 12px; background: #fff; color: var(--ce-ink); font: inherit; text-align: left; cursor: pointer; }
.ce-parcours__btn:hover { background: var(--ce-hover); border-color: #94A3B8; }
.ce-parcours__nom { font-size: .9375rem; font-weight: 700; line-height: 1.3; }
.ce-parcours__desc { font-size: .8125rem; line-height: 1.4; color: var(--ce-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ce-parcours__n { font-size: .75rem; font-weight: 600; color: var(--ce-muted); }
.ce-parcours__btn::after { content: ""; position: absolute; top: 12px; right: 12px; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid #94A3B8; box-sizing: border-box; }
.ce-parcours__btn[aria-pressed="true"] { border-color: var(--ce-accent); box-shadow: inset 0 0 0 1px var(--ce-accent); background: #fff; }
.ce-parcours__btn[aria-pressed="true"]::after { border-color: var(--ce-accent); background: var(--ce-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.500 10.500l3 3 6-6.500' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat; }
.ce-champ-bouton { position: relative; }
.ce-champ-bouton .ce-champ { padding-right: 44px; }
.ce-champ-bouton__x { position: absolute; top: 0; right: 0; }
.ce-champ-bouton__x[hidden] { display: none; }
.ce-catalogue { margin-top: 8px; }
.ce-theme { border-top: 1px solid var(--ce-line); }
.ce-theme > summary { list-style: none; gap: 10px; }
.ce-theme > summary::-webkit-details-marker { display: none; }
.ce-theme > summary::before { content: ""; flex: none; width: 7px; height: 7px; margin: 0 4px 0 2px; border-right: 2px solid var(--ce-muted); border-bottom: 2px solid var(--ce-muted); transform: rotate(-45deg); transition: transform .15s; }
.ce-theme[open] > summary::before { transform: rotate(45deg); }
.ce-theme__nom { flex: 1 1 auto; min-width: 0; }
.ce-theme > summary:hover { background: var(--ce-hover); }
.ce-couches { padding: 0 0 8px 6px; }
.ce-couche { gap: 10px; padding-right: 4px; }
.ce-couche:hover { background: var(--ce-hover); }
.ce-sw { background: #94A3B8; }
.ce-sw__in:checked + .ce-sw { background: var(--ce-accent); }
.ce-parcours__btn:focus-visible, .ce-lien:focus-visible, .ce-fiche__titre:focus-visible { outline: 3px solid var(--ui-focus, #0052A3); outline-offset: 2px; }
.ce-btn { border-color: #CBD5E1; }
.ce-chip { border-color: #CBD5E1; gap: 8px; }
@media (prefers-reduced-motion: reduce) { .ce-theme > summary::before { transition: none; } }

/* ---- aperçu au survol (ordinateur) */
.leaflet-tooltip.ce-tip { width: max-content; max-width: 280px; padding: 10px 12px; border: 0; border-radius: 12px; box-shadow: 0 6px 20px rgba(15, 23, 42, .3); white-space: normal; color: var(--ce-ink); font: var(--t-compact); pointer-events: none; }
.leaflet-tooltip-top.ce-tip::before { border-top-color: #fff; }
.leaflet-tooltip-bottom.ce-tip::before { border-bottom-color: #fff; }
.leaflet-tooltip-left.ce-tip::before { border-left-color: #fff; }
.leaflet-tooltip-right.ce-tip::before { border-right-color: #fff; }
.ce-tip__in { display: flex; align-items: center; gap: 10px; }
.ce-tip__txt { display: grid; gap: 1px; min-width: 0; }
.ce-tip__txt strong { font-size: .9375rem; line-height: 1.3; overflow-wrap: anywhere; }
.ce-tip__txt span { font-size: .8125rem; color: var(--ce-muted); }
.ce-tip__cta { display: block; margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--ce-line); font-size: .75rem; color: var(--ce-muted); }

/* ---- fiche : carte flottante (ordinateur, tablette), feuille en bas d'écran (téléphone en portrait) */
.ce-fiche { position: absolute; z-index: 650; top: 8px; right: 64px; display: flex; flex-direction: column; width: 340px; max-width: calc(100% - 72px); max-height: calc(100% - 16px); box-sizing: border-box; border-radius: 14px; background: #fff; box-shadow: 0 8px 28px rgba(15, 23, 42, .32); overflow: hidden; color: var(--ce-ink); }
.ce-fiche[hidden] { display: none; }
.ce-fiche__poignee { display: none; flex: none; width: 44px; height: 5px; margin: 8px auto 0; border-radius: 3px; background: #CBD5E1; }
.ce-fiche__tete { flex: none; display: flex; align-items: flex-start; gap: 12px; padding: 14px 6px 12px 14px; border-bottom: 1px solid var(--ce-line); }
.ce-fiche__ident { flex: 1 1 auto; min-width: 0; }
.ce-fiche__type { margin: 0 0 2px; font-size: .75rem; line-height: 1rem; font-weight: 600; color: var(--ce-muted); }
.ce-fiche__titre { margin: 0; font-size: 1.125rem; line-height: 1.3; font-weight: 700; color: var(--ce-ink); overflow-wrap: anywhere; }
.ce-fiche__titre:focus { outline: 0; }
.ce-fiche__titre:focus-visible { outline: 3px solid var(--ui-focus, #0052A3); }
.ce-fiche__corps { display: grid; gap: 14px; padding: 12px 14px 16px; overflow-y: auto; overscroll-behavior: contain; }
.ce-fiche__photo { display: block; width: 100%; height: 150px; object-fit: cover; border-radius: 10px; background: var(--ce-hover); }
.ce-fiche__photo--logo { height: 96px; padding: 12px; box-sizing: border-box; object-fit: contain; background: #fff; border: 1px solid var(--ce-line); }
.ce-plan { position: relative; height: 120px; overflow: hidden; border: 1px solid var(--ce-line); border-radius: 10px; background: #E2E8F0; }
.ce-plan img { position: absolute; max-width: none; }
.ce-plan__pin { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; box-sizing: border-box; border: 3px solid #fff; border-radius: 50%; background: var(--ce-ink); box-shadow: 0 1px 4px rgba(15, 23, 42, .5); }
.ce-fiche__infos { display: grid; gap: 8px; margin: 0; }
.ce-fiche__infos > div { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.3fr); gap: 8px; font: var(--t-compact); }
.ce-fiche__infos dt { color: var(--ce-muted); }
.ce-fiche__infos dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.ce-fiche__infos a { color: var(--ce-accent); text-underline-offset: 3px; }
.ce-fiche__liens { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ce-lien { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 14px; box-sizing: border-box; border: 1px solid #CBD5E1; border-radius: 8px; background: #fff; color: var(--ce-ink); font-size: .9375rem; font-weight: 600; text-align: center; text-decoration: none; }
.ce-lien:hover { background: var(--ce-hover); }
.ce-lien--plein { border-color: var(--ce-accent); background: var(--ce-accent); color: #fff; }
.ce-lien--plein:hover { background: var(--ce-accent-fort); }
.ce-carte--outils .ce-fiche { right: auto; left: 8px; }
a.ce-barre__btn { text-decoration: none; }

/* ---- tablette et petits écrans : le panneau devient un tiroir par-dessus la carte plein écran */
@media (max-width: 1023.98px) {
    .ce-scene, .ce-scene--replie { display: block; }
    .ce-carte { position: absolute; inset: 0; }
    .ce-panneau { position: absolute; z-index: 700; top: 0; bottom: 0; left: 0; width: min(360px, calc(100% - 56px)); border-right: 0; box-shadow: 8px 0 24px rgba(15, 23, 42, .25); }
    .ce-panneau.est-ferme { transform: translateX(-104%); visibility: hidden; }
    @media (prefers-reduced-motion: no-preference) { .ce-panneau { transition: transform .2s ease, visibility .2s; } }
}
@media (max-width: 767.98px) {
    .ce-tete .ui-breadcrumb li:not(:nth-last-child(2)) { display: none; }
    .ce-tete .ui-breadcrumb li:nth-last-child(2) a::before { content: "‹ "; }
    .ce-flot { width: min(300px, 100%); }
    .ce-chip__nom { max-width: 150px; }
    .ce-chrono__titre { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
/* téléphone en portrait : tiroir à 3 positions au bas de la carte, fiche en feuille */
@media (max-width: 767.98px) and (max-device-aspect-ratio: 1/1) {
    .ce-btn--flot { display: none; }
    .ce-panneau, .ce-panneau.est-ferme { top: auto; right: 0; bottom: 0; width: auto; height: 84px; border-radius: 14px 14px 0 0; box-shadow: 0 -4px 20px rgba(15, 23, 42, .3); visibility: visible; transform: none; }
    .ce-panneau[data-pos="1"] { height: 50%; }
    .ce-panneau[data-pos="2"] { height: calc(100% - 12px); }
    @media (prefers-reduced-motion: no-preference) { .ce-panneau { transition: height .2s ease; } }
    .ce-poignee { display: flex; align-items: center; justify-content: center; flex: none; width: 100%; height: 44px; padding: 0; border: 0; border-radius: 14px 14px 0 0; background: transparent; cursor: pointer; touch-action: none; }
    .ce-poignee__barre { width: 44px; height: 5px; border-radius: 3px; background: #94A3B8; }
    .ce-panneau__tete { border-bottom: 0; background: transparent; padding: 0 4px 6px 16px; }
    .ce-btn-icone[data-ce-replier] { display: none; }
    .ce-bas { bottom: 100px; }
    .ce-barre { max-height: calc(100% - 100px); }   /* au-dessus du tiroir : les boutons en trop passent sur une seconde colonne */
    .ce-fiche { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-width: none; max-height: 64%; border-radius: 16px 16px 0 0; z-index: 760; }
    .ce-fiche__poignee { display: block; }
    .ce-fiche__tete { padding-top: 6px; }
    .ce-fiche__corps { padding-bottom: 20px; }
    .ce-carte--fiche .ce-bas { display: none; }
}
@media (max-width: 767.98px) { .ce-carte--outils .ce-bas, .ce-carte--outils .ce-haut { display: none; } .ce-tete .ui-breadcrumb li::before { display: none; } }
/* téléphone en paysage : la carte prend toute la hauteur, le titre reste pour les lecteurs d'écran */
@media (max-height: 520px) and (orientation: landscape) {
    :root { --ce-tete-h: 0px; }
    .ce-tete { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); }
    .ce-scene { min-height: 280px; }
    .ce-fiche { max-height: calc(100% - 16px); }
}

.ce-rech__ligne .ce-champ { flex: 1 1 auto; }
.ce-rech__ligne .ce-btn { flex: none; }
.ce-btn--discret { white-space: nowrap; }
@media (max-width: 767.98px) {
    .ce-chips { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; max-height: none; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .ce-chips::-webkit-scrollbar { display: none; }
    .ce-chip, .ce-chip--tout { flex: none; }
}
@media (max-width: 767.98px) and (max-device-aspect-ratio: 1/1) { .ce-carte.ce-carte--fiche { z-index: 800; } }
.ce-chrono__annees { overflow-x: auto; scrollbar-width: thin; }
.ce-chrono__annees li { flex: 1 0 44px; }

/* Sous la carte : une carte par producteur de données, tableaux en grille (dépliés, ils prennent toute la largeur) */
.ce-sources-grille { list-style: none; margin: var(--s-3, 16px) 0 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.ce-source-carte { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: #fff; border: 1px solid var(--ce-line); border-radius: var(--r-md, 10px); min-width: 0; }
.ce-source-carte p { margin: 0; overflow-wrap: anywhere; }
.ce-source-carte__org { font-weight: 700; font-size: 16px; color: var(--ce-ink); }
.ce-source-carte__org a { color: inherit; }
.ce-source-carte__ind { font-size: 14px; font-weight: 600; color: var(--ce-accent); }
.ce-source-carte__meta, .ce-source-carte__note { font-size: 13px; line-height: 1.45; color: var(--ce-muted); }
.ce-source-carte__note:empty { display: none; }
.ce-sources-note { margin-top: var(--s-3, 16px); max-width: 80ch; }
.ce-tableaux-grille { display: grid; gap: 8px 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); margin-top: var(--s-2, 12px); }
.ce-tableaux-grille > .ce-tableau { margin: 0; }
.ce-tableaux-grille > .ce-tableau[open] { grid-column: 1 / -1; }

/* repli sur l'intercommunalité (#312) : légende hachurée et cellule du tableau */
.ce-flot .ui-map__legende i.ce-hach { background: repeating-linear-gradient(45deg, var(--c-brand) 0 3px, var(--c-surface, #fff) 3px 6px); }
.ce-tableau .ce-repli { font-style: italic;  }
.ce-tableau .ce-repli sup { margin-left: 2px; }
