  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  :root {
    --bg: #f5f2eb;
    --panel: #faf8f4;
    --border: #d9d3c7;
    --bandeau: linear-gradient(135deg, #7bbab7 0%, #272459 100%);
    --text: #1a1714;
    --muted: #8a8070;
    --accent-form: #1779ba;
    --accent-ent: #7a2382;
    --shadow: 0 2px 12px rgba(26,23,20,0.10);
    --radius: 6px;
    --panel-w: 340px;
  }

  body {
    font-family: 'Roboto Mono', monospace;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  header {
    background: var(--bandeau);
    color: var(--bg);
    padding: 0 24px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-bottom: 1px solid #333;
  }
  .header-meta {
    font-size: 10px; color: #fff; font-weight: 600;
    text-transform: uppercase; letter-spacing: 1.5px;
  }

  .app { display: flex; flex: 1; overflow: hidden; }

  /* ═══ SIDEBAR ═══ */
  .sidebar {
    width: var(--panel-w);
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    overflow: hidden; flex-shrink: 0;
    box-shadow: var(--shadow); z-index: 10;
    transition: width 0.3s cubic-bezier(0.4,0,0.2,1);
  }
  .sidebar.collapsed { width: 48px; }
  .sidebar.collapsed .sidebar-scroll,
  .sidebar.collapsed .results-bar { display: none; }
  .sidebar.collapsed .sidebar-icons { display: flex; }

  .toggle-btn {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 14px; height: 38px; flex-shrink: 0;
    cursor: pointer; border-bottom: 1px solid var(--border);
    background: var(--bg); user-select: none;
    font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px;
    color: var(--muted); transition: background 0.15s, color 0.15s;
  }
  .toggle-btn:hover { background: #ece8e0; color: var(--text); }
  .sidebar.collapsed .toggle-btn { justify-content: center; padding: 0; }
  .sidebar.collapsed .toggle-label { display: none; }
  .toggle-arrow { font-size: 12px; transition: transform 0.3s; }
  .sidebar.collapsed .toggle-arrow { transform: rotate(180deg); }

  .sidebar-icons {
    display: none; flex-direction: column;
    align-items: center; gap: 6px; padding: 12px 0; flex: 1;
  }
  .sidebar-icon-btn {
    width: 36px; height: 36px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 16px; position: relative; transition: background 0.15s;
  }
  .sidebar-icon-btn:hover { background: rgba(0,0,0,0.06); }
  .icon-dot {
    position: absolute; top: 3px; right: 3px;
    width: 8px; height: 8px; border-radius: 50%;
    border: 2px solid var(--panel); display: none;
  }
  .sidebar-icon-btn.has-filter .icon-dot { display: block; }
  .icon-form-dot { background: var(--accent-form); }
  .icon-ent-dot  { background: var(--accent-ent); }
  .sidebar-icon-sep { width: 20px; height: 1px; background: var(--border); margin: 2px 0; }

  .sidebar-scroll { flex: 1; overflow-y: auto; padding: 0 0 20px 0; }
  .sidebar-scroll::-webkit-scrollbar { width: 4px; }
  .sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
  .sidebar-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

  /* SECTIONS */
  .section { border-bottom: 1px solid var(--border); }
  .section-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; cursor: pointer; user-select: none; transition: background 0.15s;
  }
  .section-header:hover { background: rgba(0,0,0,0.03); }
  .section-title-row { display: flex; align-items: center; gap: 9px; }
  .section-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
  .dot-form { background: var(--accent-form); }
  .dot-ent  { background: var(--accent-ent); }
  .section-label { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text); }
  .section-badge {
    font-size: 10px; background: var(--text); color: var(--panel);
    border-radius: 20px; padding: 1px 7px; min-width: 20px;
    text-align: center; font-weight: 500; transition: all 0.2s;
  }
  .section-badge.zero { background: var(--border); color: var(--muted); }
  .chevron { font-size: 10px; color: var(--muted); transition: transform 0.25s ease; }
  .section.open .chevron { transform: rotate(180deg); }
  .section-body { display: none; padding: 0 18px 16px; animation: fadeDown 0.2s ease; }
  .section.open .section-body { display: block; }
  @keyframes fadeDown {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* CHIPS */
  .filter-group { margin-bottom: 14px; }
  .filter-group-label {
    font-size: 9px; text-transform: uppercase; letter-spacing: 1.5px;
    color: var(--muted); margin-bottom: 7px; display: block;
  }
  .chips { display: flex; flex-wrap: wrap; gap: 5px; }
  .chip {
    font-family: 'Roboto Mono', monospace; font-size: 10.5px;
    padding: 4px 10px; border-radius: 20px; border: 1.5px solid var(--border);
    background: white; color: var(--text); cursor: pointer; transition: all 0.15s; white-space: nowrap;
  }
  .chip:hover { border-color: var(--text); }
  .chip.active-form { background: var(--accent-form); border-color: var(--accent-form); color: white; }
  .chip.active-ent  { background: var(--accent-ent);  border-color: var(--accent-ent);  color: white; }

  /* SEARCH */
  .search-wrap { position: relative; margin-bottom: 12px; }
  .search-icon {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    font-size: 12px; color: var(--muted); pointer-events: none;
  }
  .search-input {
    width: 100%; font-family: 'Roboto Mono', monospace; font-size: 11.5px;
    padding: 8px 10px 8px 30px; border: 1.5px solid var(--border);
    border-radius: var(--radius); background: white; color: var(--text);
    outline: none; transition: border-color 0.15s;
  }
  .search-input:focus { border-color: var(--accent-ent); }
  .search-input::placeholder { color: var(--muted); }
  .search-clear {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    font-size: 14px; color: var(--muted); cursor: pointer; display: none; line-height: 1; padding: 2px;
  }
  .search-clear.visible { display: block; }

  /* ACTIVITE CHIPS */
  .activite-chips { display: flex; flex-wrap: wrap; gap: 4px; }
  .activite-chip {
    font-family: 'Roboto Mono', monospace; font-size: 10px; padding: 3px 9px;
    border-radius: 20px; border: 1.5px solid var(--border); background: white;
    color: var(--text); cursor: pointer; transition: all 0.15s;
    display: flex; align-items: center; gap: 5px;
  }
  .activite-chip:hover { border-color: var(--accent-ent); }
  .activite-chip.active { background: var(--accent-ent); border-color: var(--accent-ent); color: white; }
  .activite-chip .icon { font-size: 11px; }

  .reset-row { display: flex; justify-content: flex-end; margin-top: 6px; }
  .reset-btn {
    font-family: 'Roboto Mono', monospace; font-size: 9.5px; color: var(--muted);
    background: none; border: none; cursor: pointer;
    text-decoration: underline; text-underline-offset: 2px; padding: 0; transition: color 0.15s;
  }
  .reset-btn:hover { color: var(--text); }

   /* LEGEND */
  .legend {
    position: absolute;
    top: 100px; right: 20px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 10.5px;
    box-shadow: var(--shadow);
    z-index: 20;
  }
  .legend-title {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    margin-bottom: 8px;
  }
  .legend-item {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 5px;
  }
  .legend-dot { width: 20px; height: 20px; border-radius: 50%; }

  /* RESULTS */
  .results-bar {
    padding: 10px 18px; background: var(--bg); border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
  }
  .result-item { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); }
  .result-count { font-size: 13px; font-weight: 500; color: var(--text); }
  .result-dot { width: 7px; height: 7px; border-radius: 50%; }

  /* MAP */
  .map-area { flex: 1; position: relative; overflow: hidden; }
  #map { width: 100%; height: 100%; }

  /* PILLS sur la carte */
  .active-filters {
    position: absolute; top: 14px; left: 14px; right: 14px;
    display: flex; flex-wrap: wrap; gap: 5px; z-index: 20; pointer-events: none;
  }
  .af-pill {
    background: white; border: 1.5px solid var(--border); border-radius: 20px;
    padding: 3px 10px 3px 8px; font-size: 10px;
    display: flex; align-items: center; gap: 5px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    pointer-events: all; cursor: pointer; transition: all 0.15s;
  }
  .af-pill:hover { background: #f0ece5; }
  .af-pill-dot { width: 7px; height: 7px; border-radius: 50%; }
  .af-pill-x { color: var(--muted); font-size: 12px; }

  /* POPUP MapLibre */
  .maplibregl-popup-content {
    font-family: 'Roboto Mono', monospace; font-size: 11px;
    padding: 12px 14px; border-radius: var(--radius);
    box-shadow: var(--shadow); max-width: 300px;
    height:300px;
    overflow-y:scroll;
    scrollbar-color: #272459 #7bbab7;
    scrollbar-width: thin;
  }
  .popup-name { font-weight: 600; font-size: 12px; margin-bottom: 3px; }
  .popup-adresse { color: var(--muted); font-size: 10px; }
  .popup-ville { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
  .popup-formations { list-style: none; padding: 0; margin: 0; }
  .popup-formations li {
    font-size: 10px; padding: 4px 0; border-bottom: 1px solid #eee;
    display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px;
  }
  .popup-formations li:last-child { border-bottom: none; }
  .popup-tag {
    background: var(--accent-form); color: white; border-radius: 3px;
    padding: 1px 5px; font-size: 9px; white-space: nowrap; flex-shrink: 0;
  }
  .popup-tag-ent {
    background: var(--accent-ent); color: white; border-radius: 3px;
    padding: 1px 5px; font-size: 9px; white-space: nowrap;
  }
  .popup-link {
    display: inline-block; margin-top: 8px; font-size: 9px;
    color: var(--accent-form); text-decoration: none;
  }
  .popup-link:hover { text-decoration: underline; }
  .popup-activites { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 3px; }
  .popup-desc { font-size: 10px; color: var(--muted); margin-bottom: 6px; }