/* ============================================================
   SonoMap — Page démo
   Style inspiré de shadcn/ui (https://ui.shadcn.com/)
   Strict noir / blanc / gris (sauf palettes & dégradés de données).
   ============================================================ */

/* Inter via Google Fonts — utilisé par shadcn par défaut. Chargement non
   bloquant (display: swap). */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

.demo-body {
    /* Variables shadcn-like en grays purs (pas de teinte) */
    --background:        #ffffff;
    --foreground:        #0a0a0a;
    --card:              #ffffff;
    --card-foreground:   #0a0a0a;
    --popover:           #ffffff;
    --primary:           #171717;
    --primary-foreground:#fafafa;
    --secondary:         #f5f5f5;
    --secondary-foreground:#171717;
    --muted:             #f5f5f5;
    --muted-foreground:  #737373;
    --accent:            #f5f5f5;
    --accent-foreground: #171717;
    --border:            #e5e5e5;
    --input:             #e5e5e5;
    --ring:              #0a0a0a;
    --radius:            0.625rem;     /* 10px — radius par défaut shadcn */

    margin: 0;
    padding: 0;
    background: var(--background);
    color: var(--foreground);
    font: 400 14px/1.5 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Override des variables --af-* pour neutraliser les couleurs de l'admin */
.demo-body {
    --af-primary: var(--primary);
    --af-fg:      var(--foreground);
    --af-muted:   var(--muted-foreground);
    --af-border:  var(--border);
    --af-bg-soft: var(--muted);
}

/* ============================================================
   HEADER de page
   ============================================================ */
.demo-header {
    text-align: center;
    padding: 3rem 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
}
.demo-title {
    margin: 0;
    font-size: 1.875rem;        /* 30px */
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.demo-subtitle {
    margin: .5rem 0 0;
    font-size: 0.875rem;
    color: var(--muted-foreground);
    font-weight: 400;
    letter-spacing: 0;
}

/* ============================================================
   FORM / SECTIONS
   ============================================================ */
.demo-form {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}
.demo-section { margin: 2rem 0; }
.demo-section__title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--foreground);
    margin: 0 0 1rem 0;
    padding: 0;
    border: 0;
    letter-spacing: -0.01em;
}

/* ============================================================
   CARTE — layout : carte + sidebar légende/sélecteurs
   ============================================================ */
.demo-map-wrap { background: transparent; }

.demo-map-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 2rem;
    align-items: start;
}
.demo-map-col--svg { min-width: 0; }
.demo-map-col--svg .af-svg-wrap {
    border: 0 !important;
    background: transparent !important;
    padding: 0;
}
.demo-map-col--svg .af-svg-wrap.is-zoomed { border: 0 !important; }
.demo-map-col--svg .af-svg-wrap svg { max-height: 65vh; }

/* Sidebar (légende + sélecteurs) */
.demo-map-col--side {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-top: 0;
}
.demo-legend-wrap { padding: 0; }
.demo-legend-wrap .af-legend__title {
    margin: 0 0 .6rem 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--foreground);
    letter-spacing: -0.005em;
}
.demo-legend-wrap .af-legend-grad,
.demo-legend-wrap .af-legend__list,
.demo-legend-wrap .af-legend__item {
    list-style: none;
    padding: 0;
    margin: 0;
}
.demo-legend-wrap .af-legend-grad__bar {
    height: 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
}
.demo-legend-wrap .af-legend-grad__labels {
    position: relative;
    height: 1.4em;
    margin-top: .35rem;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}
.demo-legend-wrap .af-legend-grad__label {
    position: absolute;
    transform: translateX(-50%);
    white-space: nowrap;
}
.demo-legend-wrap .af-legend-grad__label:first-child { transform: none; left: 0 !important; }
.demo-legend-wrap .af-legend-grad__label:last-child  { transform: translateX(-100%); }
.demo-legend-wrap .af-legend-grad__unit {
    display: block;
    text-align: right;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin-top: .15rem;
}
.demo-legend-wrap .af-legend__swatch {
    width: 14px; height: 14px; border-radius: 50%; border: none;
    display: inline-block; vertical-align: middle; margin-right: .5rem;
}
.demo-legend-wrap .af-legend__item {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

/* Sélecteurs Indicateur / Année */
.demo-map-selectors {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}
.demo-map-selector {
    display: flex;
    flex-direction: column;
    gap: .375rem;
}
.demo-map-selector > span {
    font-size: 0.8125rem;
    color: var(--foreground);
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}
.demo-map-selector select { width: 100%; }

@media (max-width: 920px) {
    .demo-map-row { grid-template-columns: 1fr; }
}

/* ============================================================
   TIMELINE pleine largeur
   ============================================================ */
.demo-timeline {
    margin-top: 1.5rem;
    padding: 1rem 0 0;
    background: transparent;
    border: 0;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: start;
}
.demo-timeline .af-tl-btn {
    background: var(--primary);
    border: 1px solid var(--primary);
    color: var(--primary-foreground);
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    border-radius: calc(var(--radius) - 4px);
    font-size: 0.8125rem;
    line-height: 1;
    transition: opacity .15s;
}
.demo-timeline .af-tl-btn:hover { opacity: 0.9; }

.demo-timeline__track {
    width: 100%;
    padding-top: .55rem;
}
.demo-timeline .af-tl-slider {
    width: 100%;
    accent-color: var(--primary);
    margin: 0;
    cursor: pointer;
}
.demo-timeline__years {
    display: flex;
    justify-content: space-between;
    margin-top: .35rem;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    font-variant-numeric: tabular-nums;
}
.demo-timeline__year { flex: 0 0 auto; }
.demo-timeline .af-tl-year {
    align-self: center;
    font-size: 1rem;
    font-weight: 600;
    color: var(--foreground);
    font-variant-numeric: tabular-nums;
    min-width: 3.4rem;
    text-align: right;
}

/* ============================================================
   ONGLETS de paramètres + bouton APPLIQUER
   ============================================================ */
.demo-tabs-bar {
    display: flex;
    align-items: stretch;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}
.demo-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    flex: 1 1 auto;
    border-bottom: 0;
    margin-bottom: 0;
}
.demo-tab {
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    padding: 0.625rem 1rem 0.6rem;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: color .15s, border-color .15s;
    margin-bottom: -1px;
}
.demo-tab:hover { color: var(--foreground); }
.demo-tab.is-active {
    color: var(--foreground);
    border-bottom-color: var(--foreground);
}
.demo-tab-panel {
    display: none;
    animation: demo-fade .2s ease-out;
}
.demo-tab-panel.is-active { display: block; }
@keyframes demo-fade {
    from { opacity: 0; transform: translateY(2px); }
    to   { opacity: 1; transform: translateY(0); }
}

.demo-apply-btn {
    appearance: none;
    background: var(--background);
    color: var(--muted-foreground);
    border: 0;
    border-bottom: 2px solid transparent;
    padding: 0.5rem 1rem 0.5rem;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: -1px;
    align-self: stretch;
    flex: 0 0 auto;
    transition: color .15s, background .15s, border-color .15s;
    border-radius: calc(var(--radius) - 4px) calc(var(--radius) - 4px) 0 0;
}
.demo-apply-btn:hover {
    background: var(--accent);
    color: var(--foreground);
}
.demo-apply-btn__indicator {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: background .15s;
}
.demo-apply-btn.is-pending {
    background: var(--primary);
    color: var(--primary-foreground);
    border-radius: calc(var(--radius) - 4px);
    margin: 0.3rem 0;
    padding: 0.5rem 0.875rem;
    border-bottom-color: transparent;
}
.demo-apply-btn.is-pending .demo-apply-btn__indicator {
    background: var(--primary-foreground);
    animation: demo-apply-pulse 1s ease-in-out infinite;
}
@keyframes demo-apply-pulse {
    0%,100% { opacity: 1; }
    50%     { opacity: .35; }
}

@media (max-width: 720px) {
    .demo-tabs-bar { flex-wrap: wrap; }
    .demo-tab { padding: .5rem .75rem; font-size: 0.8125rem; }
}

/* ============================================================
   FIELDSETS — style "card" shadcn
   ============================================================ */
.demo-fs {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 0 0 1rem;
    background: var(--card);
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}
.demo-fs > legend {
    padding: 0 .25rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--foreground);
    text-transform: none;
    letter-spacing: -0.005em;
    margin-left: -0.25rem;
}

.demo-grid { display: grid; gap: 1rem; align-items: end; }
.demo-grid-2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.demo-grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-top: 1rem; }
.demo-grid-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-top: 0.75rem; }

/* Labels — style shadcn (label en gras + champ en dessous) */
.demo-fs label {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}

/* ============================================================
   INPUTS — style shadcn
   ============================================================ */
.demo-fs input[type="text"],
.demo-fs input[type="number"],
.demo-fs input[type="search"],
.demo-fs select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    color: var(--foreground);
    border: 1px solid var(--input);
    border-radius: calc(var(--radius) - 4px);
    height: 2.25rem;            /* 36px */
    padding: 0 0.75rem;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 400;
    width: 100%;
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
}

/* Spinners off pour les input[type=number] */
.demo-fs input[type="number"]::-webkit-outer-spin-button,
.demo-fs input[type="number"]::-webkit-inner-spin-button,
.demo-cell-input::-webkit-outer-spin-button,
.demo-cell-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}
.demo-fs input[type="number"],
.demo-cell-input { -moz-appearance: textfield; }

.demo-fs select {
    background-image:
        linear-gradient(45deg, transparent 50%, var(--foreground) 50%),
        linear-gradient(135deg, var(--foreground) 50%, transparent 50%);
    background-position: calc(100% - 14px) 16px, calc(100% - 9px) 16px;
    background-size: 5px 5px;
    background-repeat: no-repeat;
    padding-right: 2rem;
    cursor: pointer;
}

.demo-fs input:focus,
.demo-fs select:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

.demo-fs input[type="color"] {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 2.25rem;
    border: 1px solid var(--input);
    border-radius: calc(var(--radius) - 4px);
    padding: 3px;
    background: var(--background);
    cursor: pointer;
}
.demo-fs input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.demo-fs input[type="color"]::-webkit-color-swatch {
    border: 0; border-radius: calc(var(--radius) - 6px);
}

.demo-fs input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
    margin: 0;
    height: 2.25rem;
}

/* ============================================================
   CHECKBOXES & RADIOS — style shadcn (custom)
   ============================================================ */
.demo-check, .demo-radio {
    flex-direction: row !important;
    align-items: center;
    gap: 0.5rem !important;
    cursor: pointer;
    color: var(--foreground) !important;
    font-size: 0.875rem !important;
    font-weight: 400 !important;
    user-select: none;
}
.demo-check input[type="checkbox"],
.demo-radio input[type="radio"] {
    accent-color: var(--primary);
    margin: 0;
    cursor: pointer;
    width: 1rem; height: 1rem;
}
.demo-radios { display: flex; gap: 1.5rem; flex-wrap: wrap; }

/* Modes sonification (2 colonnes) */
.demo-modes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}
.demo-modes__col { display: flex; flex-direction: column; gap: .25rem; }
.demo-modes__title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: .5rem;
    letter-spacing: -0.005em;
}
.demo-radio--mode {
    padding: .5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    background: var(--card);
    transition: background .15s, border-color .15s;
    cursor: pointer;
}
.demo-radio--mode:hover { background: var(--accent); }
.demo-radio--mode:has(input:checked) {
    border-color: var(--primary);
    background: var(--accent);
    font-weight: 500 !important;
}
@media (max-width: 700px) { .demo-modes { grid-template-columns: 1fr; } }

/* ============================================================
   PRESETS de dégradés — gardent les couleurs (data viz)
   ============================================================ */
.demo-presets { margin-top: 1.25rem; }
.demo-presets__label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
    margin-bottom: 0.625rem;
    letter-spacing: 0;
    text-transform: none;
}
.demo-presets__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.625rem;
}
.demo-preset {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    cursor: pointer;
    font: inherit;
    color: var(--foreground);
    transition: border-color .15s, background .15s;
}
.demo-preset:hover {
    border-color: var(--foreground);
    background: var(--accent);
}
.demo-preset.is-active {
    border-color: var(--primary);
    border-width: 2px;
    padding: calc(0.5rem - 1px);
}
.demo-preset__bar {
    height: 24px;
    border-radius: calc(var(--radius) - 6px);
    border: 1px solid var(--border);
}
.demo-preset__label {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    text-align: center;
}

/* ============================================================
   CHIPS années / colonnes
   ============================================================ */
.demo-block { margin-bottom: 1.25rem; }
.demo-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
    margin-bottom: 0.5rem;
    text-transform: none;
    letter-spacing: 0;
}
.demo-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    background: var(--muted);
    min-height: 2.5rem;
    align-items: center;
}
.demo-chip {
    display: inline-flex;
    align-items: center;
    gap: .15rem;
    padding: 0.25rem 0.25rem 0.25rem 0.625rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}
.demo-chip__remove {
    background: transparent;
    border: 0;
    width: 1.25rem; height: 1.25rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1;
    color: var(--muted-foreground);
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0;
    transition: background .15s, color .15s;
}
.demo-chip__remove:hover { background: var(--primary); color: var(--primary-foreground); }

.demo-add-row { display: flex; gap: .5rem; margin-top: .5rem; }
.demo-add-row input {
    flex: 1; max-width: 14rem;
    height: 2.25rem;
    padding: 0 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--input);
    border-radius: calc(var(--radius) - 4px);
    background: var(--background);
    box-sizing: border-box;
}
.demo-add-row input:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

/* ============================================================
   BOUTONS — style shadcn
   ============================================================ */
.demo-btn {
    appearance: none;
    background: var(--primary);
    color: var(--primary-foreground);
    border: 1px solid var(--primary);
    border-radius: calc(var(--radius) - 4px);
    height: 2.25rem;
    padding: 0 1rem;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    transition: opacity .15s, background .15s;
    line-height: 1;
}
.demo-btn:hover { opacity: 0.9; }
.demo-btn--ghost {
    background: var(--background);
    color: var(--foreground);
    border-color: var(--border);
}
.demo-btn--ghost:hover {
    background: var(--accent);
    color: var(--foreground);
    opacity: 1;
}
.demo-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 0.75rem; }

.demo-range-value {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    font-variant-numeric: tabular-nums;
    margin-top: .25rem;
}
.demo-help {
    margin: 0 0 1rem 0;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

/* ============================================================
   PETITS BOUTONS RONDS — × / + dans le tableau
   ============================================================ */
.demo-icon-btn {
    width: 1.25rem; height: 1.25rem;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--foreground);
    font-size: 0.75rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s, border-color .15s;
    flex: 0 0 auto;
    vertical-align: middle;
}
.demo-icon-btn:hover {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}
.demo-icon-btn:active { transform: scale(.94); }

/* ============================================================
   TUILES (Carte et Visualisation) — style "card sélectionnable"
   ============================================================ */
.demo-tile-grid {
    display: grid;
    gap: 0.75rem;
    margin: 0.5rem 0 1rem;
}
.demo-tile-grid--3 { grid-template-columns: repeat(3, 1fr); max-width: 420px; }
.demo-tile-grid--4 { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); max-width: 560px; }

.demo-tile {
    appearance: none;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    padding: 0.875rem 0.5rem 0.75rem;
    cursor: pointer;
    color: var(--foreground);
    font: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: border-color .15s, background .15s, box-shadow .15s;
    text-align: center;
    line-height: 1.3;
}
.demo-tile:hover {
    border-color: var(--foreground);
    background: var(--accent);
}
.demo-tile.is-active {
    border-color: var(--primary);
    border-width: 2px;
    padding: calc(0.875rem - 1px) calc(0.5rem - 1px) calc(0.75rem - 1px);
    box-shadow: 0 0 0 2px var(--background), 0 0 0 3px var(--primary);
}

.demo-tile-img {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    color: var(--foreground);
}
.demo-tile-img > svg,
.demo-tile-img > img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    display: block;
    /* Strict noir/blanc/gris : on grayscale les images en couleur (cartogram.png).
       Le SVG inline utilise déjà currentColor donc pas affecté. */
    filter: grayscale(1);
    transition: filter .2s;
}
.demo-tile.is-active .demo-tile-img > img { filter: grayscale(1); }
.demo-tile-img > svg path,
.demo-tile-img > svg circle,
.demo-tile-img > svg rect,
.demo-tile-img > svg polygon,
.demo-tile-img > svg line { color: var(--muted-foreground); }
.demo-tile.is-active .demo-tile-img > svg path,
.demo-tile.is-active .demo-tile-img > svg circle,
.demo-tile.is-active .demo-tile-img > svg rect,
.demo-tile.is-active .demo-tile-img > svg polygon,
.demo-tile.is-active .demo-tile-img > svg line,
.demo-tile:hover .demo-tile-img > svg path,
.demo-tile:hover .demo-tile-img > svg circle,
.demo-tile:hover .demo-tile-img > svg rect,
.demo-tile:hover .demo-tile-img > svg polygon,
.demo-tile:hover .demo-tile-img > svg line { color: var(--foreground); }

.demo-tile-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: inherit;
}

/* Sous-selects (continent / pays / variant / cartogram-type) */
.demo-sub-select {
    margin: 0.5rem 0 1rem;
    max-width: 380px;
}
.demo-sub-select label {
    display: flex !important;
    flex-direction: column;
    gap: .375rem;
}
.demo-sub-select label > span:first-child {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
    text-transform: none;
    letter-spacing: 0;
}
.demo-sub-select[hidden] { display: none; }
.demo-fs > .demo-sub-select + .demo-sub-select { margin-top: -0.5rem; }

@media (max-width: 540px) {
    .demo-tile-grid--3 { max-width: none; }
    .demo-tile-grid--4 { grid-template-columns: repeat(2, 1fr); max-width: none; }
    .demo-tile-img,
    .demo-tile-img > svg,
    .demo-tile-img > img { width: 48px; height: 48px; }
}

/* ============================================================
   TABLEAU
   ============================================================ */
.demo-data-toolbar {
    display: flex; gap: .5rem; align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.demo-data-filter {
    flex: 1; max-width: 22rem;
    height: 2.25rem;
    padding: 0 0.75rem;
    font: inherit;
    font-size: 0.875rem;
    border: 1px solid var(--input);
    border-radius: calc(var(--radius) - 4px);
    background: var(--background);
    color: var(--foreground);
}
.demo-data-filter::placeholder { color: var(--muted-foreground); }
.demo-data-filter:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

.demo-table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: auto;
    max-height: 540px;
    background: var(--card);
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}
.demo-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 600px;
    font-size: 0.875rem;
}
.demo-table thead {
    position: sticky; top: 0; z-index: 1;
    background: var(--muted);
}
.demo-table th {
    text-align: left;
    padding: 0.75rem 0.875rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.demo-th-col__label { display: inline-block; margin-right: .35rem; }
.demo-th-col__remove { vertical-align: middle; }
.demo-table .demo-th-add {
    width: 1%;
    padding: 0.5rem 0.5rem;
    text-align: center;
}
.demo-table .demo-th-row-actions { width: 1%; }

.demo-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.demo-table tr:last-child td { border-bottom: 0; }
.demo-table tr:hover td { background: var(--accent); }
.demo-table tr.is-hidden { display: none; }
.demo-table tr.is-cleared td { color: var(--muted-foreground); }
.demo-table tr.is-cleared .demo-cell-input {
    color: var(--muted-foreground);
    background: var(--muted);
}

.demo-td-iso {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    font-weight: 500;
}
.demo-td-cell-spacer { width: 1%; padding: 0 !important; }
.demo-td-row-action {
    width: 1%;
    padding: 0.5rem 0.75rem 0.5rem 0.25rem !important;
    text-align: center;
}

.demo-cell-input {
    width: 100%;
    padding: 0.25rem 0.5rem;
    font: inherit;
    font-size: 0.875rem;
    border: 1px solid transparent;
    background: transparent;
    border-radius: calc(var(--radius) - 6px);
    box-sizing: border-box;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--foreground);
    appearance: textfield;
    -moz-appearance: textfield;
}
.demo-cell-input:hover:not(:read-only) { background: var(--background); border-color: var(--border); }
.demo-cell-input:focus {
    outline: none;
    background: var(--background);
    border-color: var(--ring);
    box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}
.demo-cell-input:read-only { cursor: not-allowed; }

/* Marquage cellule éditée */
.demo-cell-input.is-edited {
    background: var(--accent);
    font-weight: 600;
}
.demo-cell-input.is-edited:focus { background: var(--background); }

/* Override des éléments af-* (zoom controls) */
.demo-section--map .af-zoom-btn {
    background: var(--background);
    border: 1px solid var(--border);
    color: var(--foreground);
    border-radius: calc(var(--radius) - 4px);
    transition: background .15s;
}
.demo-section--map .af-zoom-btn:hover { background: var(--accent); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 720px) {
    .demo-header { padding: 2rem 1rem 1.5rem; }
    .demo-title { font-size: 1.5rem; }
    .demo-subtitle { font-size: 0.8125rem; }
    .demo-form { padding: 1.5rem 1rem 3rem; }
    .demo-fs { padding: 1.25rem; }
    .demo-data-toolbar { flex-direction: column; align-items: stretch; }
    .demo-data-filter { max-width: none; }
}

/* ============================================================
   GRANDS ONGLETS — Paramètres / Tableau
   Visuel : zone d'onglets posée sur un fond gris clair. L'onglet actif a
   le même fond que le contenu (effet "carte qui dépasse vers le haut")
   pour donner l'impression que l'onglet est l'extension visuelle du panel.
   ============================================================ */

/* Wrapper de toute la zone (onglets + panel) sur fond gris clair */
.demo-mainwrap {
    background: var(--muted);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem 1.25rem;
    margin: 1.5rem 0 0;
    border: 1px solid var(--border);
}

.demo-mainnav {
    display: flex;
    align-items: stretch;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border);
    margin: 0 0 1.25rem;
    padding: 0;
}
.demo-mainnav-btn {
    appearance: none;
    background: transparent;        /* discret au repos */
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: calc(var(--radius) - 4px) calc(var(--radius) - 4px) 0 0;
    padding: 0.625rem 1.25rem 0.7rem;
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: color .15s, background .15s, border-color .15s;
    margin-bottom: -1px;
    position: relative;
    top: 0.5rem;                    /* aligne avec le padding-top du wrapper */
}
.demo-mainnav-btn:hover {
    color: var(--foreground);
    background: rgba(255, 255, 255, 0.5);
}
/* Onglet actif : fond BLANC (= fond des panels) avec bordures qui se
   "raccordent" au panel. Effet d'onglet qui dépasse au-dessus du panel. */
.demo-mainnav-btn.is-active {
    color: var(--foreground);
    background: var(--card);            /* blanc, comme le panel */
    border-color: var(--border);
    border-bottom-color: var(--card);   /* masque la bordure du bas pour fusionner */
    font-weight: 600;
    z-index: 2;
}
.demo-mainnav .demo-apply-btn {
    margin-left: auto;
    align-self: center;
}

/* Panel actif : fond BLANC (par opposition au gris du wrapper) */
.demo-mainpanel { display: block; }
.demo-mainpanel[hidden] { display: none; }
.demo-mainpanel:not([hidden]) {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0 var(--radius) var(--radius) var(--radius);
    padding: 1.25rem;
}

/* ============================================================
   PARAMÈTRES — grille 4 colonnes / blocs sur fond BLANC
   (la zone autour est gris clair via .demo-mainwrap)
   ============================================================ */
.demo-params-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    align-items: stretch;
}
@media (max-width: 1100px) { .demo-params-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .demo-params-grid { grid-template-columns: 1fr; } }

.demo-block {
    background: var(--card);                   /* BLANC */
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.04);
}
.demo-block__title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--foreground);
    letter-spacing: -0.005em;
}
.demo-block__hint {
    margin: -0.5rem 0 0;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}
.demo-block__group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.demo-block__group + .demo-block__group {
    margin-top: 0.5rem;
    padding-top: 0.875rem;
    border-top: 1px solid var(--border);
}
.demo-block__group-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Champs dans les blocs */
.demo-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.demo-field--inline {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}
.demo-field--inline > .demo-field__label { flex: 0 0 auto; margin: 0; }
.demo-field--inline > select { flex: 0 1 auto; width: auto; }
.demo-field__label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--foreground);
}
.demo-field select,
.demo-field input[type="text"],
.demo-field input[type="number"] {
    appearance: none;
    -webkit-appearance: none;
    background: var(--background);
    color: var(--foreground);
    border: 1px solid var(--input);
    border-radius: calc(var(--radius) - 4px);
    height: 2.25rem;
    padding: 0 0.75rem;
    font: inherit;
    font-size: 0.875rem;
    width: 100%;
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
}
.demo-field select {
    background-image:
        linear-gradient(45deg, transparent 50%, var(--foreground) 50%),
        linear-gradient(135deg, var(--foreground) 50%, transparent 50%);
    background-position: calc(100% - 14px) 16px, calc(100% - 9px) 16px;
    background-size: 5px 5px;
    background-repeat: no-repeat;
    padding-right: 2rem;
    cursor: pointer;
}
.demo-field input:focus,
.demo-field select:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px var(--muted), 0 0 0 4px var(--ring);
}

/* Sub-field sous une checkbox (pour les sons et octaves) */
.demo-sub-field {
    margin-top: 0.5rem;
    padding-left: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.demo-sub-field[hidden] { display: none; }
.demo-sub-field__label {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Toggle (checkbox plus visible) */
.demo-toggle {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.875rem;
    color: var(--foreground);
}
.demo-toggle input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 2.5rem;
    height: 1.4rem;
    border-radius: 9999px;
    background: var(--border);
    position: relative;
    cursor: pointer;
    transition: background .2s;
    margin: 0;
    flex: 0 0 auto;
}
.demo-toggle input[type="checkbox"]::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 50%;
    background: white;
    transition: transform .2s;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.15);
}
.demo-toggle input[type="checkbox"]:checked {
    background: var(--primary);
}
.demo-toggle input[type="checkbox"]:checked::before {
    transform: translateX(1.1rem);
}

/* ============================================================
   PICKER COULEUR CUSTOM (sans palette navigateur)
   ============================================================ */
.demo-color-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border: 1px solid var(--input);
    border-radius: calc(var(--radius) - 4px);
    background: var(--background);
    cursor: pointer;
    transition: border-color .15s;
    user-select: none;
}
.demo-color-trigger:hover { border-color: var(--foreground); }
.demo-color-trigger:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px var(--muted), 0 0 0 4px var(--ring);
}
.demo-color-trigger__swatch {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: calc(var(--radius) - 6px);
    border: 1px solid var(--border);
    display: inline-block;
    flex: 0 0 auto;
}
.demo-color-trigger__hex {
    font: 0.8125rem ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--foreground);
    text-transform: uppercase;
}

.demo-color-popover {
    position: absolute;
    z-index: 100;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.875rem;
    box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
    min-width: 220px;
}
.demo-color-popover[hidden] { display: none; }
.demo-color-popover__swatches {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.3rem;
    margin-bottom: 0.75rem;
}
.demo-color-popover__swatch {
    appearance: none;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 6px);
    width: 100%;
    aspect-ratio: 1;
    cursor: pointer;
    padding: 0;
    transition: transform .12s, border-color .12s;
}
.demo-color-popover__swatch:hover {
    transform: scale(1.08);
    border-color: var(--foreground);
}
.demo-color-popover__hexrow {
    display: flex;
    gap: 0.5rem;
    align-items: end;
}
.demo-color-popover__hexrow label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.demo-color-popover__hexrow label > span {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    font-weight: 500;
}
.demo-color-popover__hexrow input {
    height: 2.25rem;
    padding: 0 0.6rem;
    border: 1px solid var(--input);
    border-radius: calc(var(--radius) - 4px);
    font: 0.875rem ui-monospace, monospace;
    text-transform: uppercase;
    width: 100%;
    box-sizing: border-box;
}
.demo-color-popover__hexrow input:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

/* ============================================================
   PRESETS de dégradés — version compacte (5 vignettes en ligne)
   ============================================================ */
.demo-presets-compact {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.demo-preset-compact {
    appearance: none;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    font: inherit;
    color: var(--foreground);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: border-color .15s, background .15s;
}
.demo-preset-compact:hover {
    border-color: var(--foreground);
}
.demo-preset-compact.is-active {
    border-color: var(--primary);
    background: var(--background);
    box-shadow: 0 0 0 2px var(--muted), 0 0 0 3px var(--primary);
}
.demo-preset-compact__bar {
    flex: 1;
    height: 18px;
    border-radius: calc(var(--radius) - 6px);
    border: 1px solid var(--border);
}
.demo-preset-compact__label {
    flex: 0 0 auto;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    min-width: 70px;
    text-align: right;
}

/* ============================================================
   MODES SONIFICATION compact (5 boutons en grille)
   ============================================================ */
.demo-modes-compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 0.35rem;
}
.demo-mode-radio {
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    background: var(--background);
    transition: border-color .15s, background .15s;
    font-size: 0.8125rem !important;
    color: var(--foreground) !important;
    user-select: none;
}
.demo-mode-radio input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.demo-mode-radio:hover { border-color: var(--foreground); }
.demo-mode-radio.is-active {
    border-color: var(--primary);
    background: var(--muted);
    font-weight: 600 !important;
}

/* ============================================================
   TABLEAU — actions sous le tableau
   ============================================================ */
.demo-table-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.875rem;
    flex-wrap: wrap;
}

/* ============================================================
   MODAL "Ajouter une ligne"
   ============================================================ */
.demo-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.demo-modal[hidden] { display: none; }
.demo-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    cursor: pointer;
}
.demo-modal__panel {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 40px rgb(0 0 0 / 0.2);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.demo-modal__title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}
.demo-modal__help {
    margin: -0.5rem 0 0;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}
.demo-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* ============================================================
   v2 — REFONTE BASÉE SUR MAQUETTES
   Les règles ci-dessous écrasent certaines règles définies plus haut.
   ============================================================ */

/* Header retiré (titre + sous-titre maintenant dans la section carte) */
.demo-header { display: none; }

/* Le form n'a plus de max-width étroit : on veut le fond gris pleine largeur
   sous les onglets. On garde un padding intérieur. */
.demo-form {
    max-width: none;
    margin: 0;
    padding: 0;
}

/* La carte en haut garde une largeur max centrée */
.demo-section--map {
    max-width: 1180px;
    margin: 1.5rem auto 0;
    padding: 0 1.5rem;
}

/* ============================================================
   HEADER de la section carte : titre/sous-titre + selects
   ============================================================ */
.demo-map-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 1.5rem;
    /* Pas de bordure entre titre et carte (consigne) */
}
.demo-map-header__brand {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    text-align: left;
}
.demo-map-header__brand .demo-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--foreground);
    line-height: 1.2;
}
.demo-map-header__brand .demo-subtitle {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--muted-foreground);
    text-transform: none;
    letter-spacing: 0;
}

/* Selects en haut à droite : sur une ligne, label au-dessus du select */
.demo-map-header__selectors {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}
.demo-map-header__selectors .demo-map-selector {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 130px;
}
.demo-map-header__selectors .demo-map-selector > span {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}
/* Style des selects identique à ceux dans les blocs paramètres */
.demo-map-header__selectors .demo-map-selector select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--background);
    color: var(--foreground);
    border: 1px solid var(--input);
    border-radius: calc(var(--radius) - 4px);
    height: 2.25rem;
    padding: 0 0.75rem;
    font: inherit;
    font-size: 0.875rem;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--foreground) 50%),
        linear-gradient(135deg, var(--foreground) 50%, transparent 50%);
    background-position: calc(100% - 14px) 16px, calc(100% - 9px) 16px;
    background-size: 5px 5px;
    background-repeat: no-repeat;
    padding-right: 2rem;
    transition: border-color .15s;
}
.demo-map-header__selectors .demo-map-selector select:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

/* Carte : retire l'aside sidebar (on a déjà déplacé les selects).
   La légende est maintenant sous la carte ou à droite selon la place. */
.demo-map-row {
    grid-template-columns: minmax(0, 1fr) 280px;
}

/* Légende : titre + sa barre, avec unité affichée */
.demo-legend-wrap .af-legend__title .af-legend__unit {
    font-weight: 400;
    color: var(--muted-foreground);
    font-size: 0.8125rem;
    margin-left: 0.2rem;
}
.demo-legend-wrap .af-legend-grad__unit {
    /* déjà rendu par af_render_gradient_legend_html : on s'assure du style */
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/* ============================================================
   TIMELINE : play rond + prev/next + slider avec ticks
   ============================================================ */
.demo-timeline {
    margin-top: 1.25rem;
    padding: 0.5rem 0;
    background: transparent;
    border: 0;                  /* retire filet au-dessus */
    border-top: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Bouton play : RONDE, vert SonoMap, avec icône lecture/pause SVG */
.demo-timeline .af-tl-btn.demo-tl-play {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #1b8a4e;        /* vert SonoMap (cf. maquette) */
    border-color: #1b8a4e;
    color: #ffffff;
    padding: 0;
}
.demo-timeline .af-tl-btn.demo-tl-play:hover {
    background: #146d3d;
    border-color: #146d3d;
    opacity: 1;
}

/* Boutons prev/next : carrés discrets */
.demo-timeline .af-tl-btn.demo-tl-prev,
.demo-timeline .af-tl-btn.demo-tl-next {
    width: 28px;
    height: 28px;
    background: transparent;
    border: 0;
    color: var(--muted-foreground);
    padding: 0;
}
.demo-timeline .af-tl-btn.demo-tl-prev:hover,
.demo-timeline .af-tl-btn.demo-tl-next:hover {
    color: var(--foreground);
    background: var(--accent);
    border-radius: 50%;
}

/* Track timeline : contient ticks verticaux + slider */
.demo-timeline__track {
    flex: 1;
    position: relative;
    height: 40px;
    padding: 0;
}

/* Ticks verticaux : barres grises positionnées à gauche en %,
   avec l'année rendue en dessous (visible en mode desktop) */
.demo-timeline__ticks {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    height: 24px;
    pointer-events: none;        /* ne bloque pas le slider */
}
.demo-timeline__tick {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    width: 1px;
    height: 8px;
    background: var(--border);
    font-size: 0.75rem;
    color: var(--muted-foreground);
    text-indent: -1px;            /* pour aligner le texte sous le tick */
    line-height: 1;
    padding-top: 14px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
/* Le texte de l'année est visible sous chaque tick */
.demo-timeline__tick::before {
    content: '';
}
/* L'année en cours (sera ajoutée par JS via classe is-current) */
.demo-timeline__tick.is-current {
    color: var(--foreground);
    font-weight: 700;
}

/* Slider lui-même : superposé aux ticks */
.demo-timeline .af-tl-slider {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    width: 100%;
    margin: 0;
    accent-color: var(--foreground);
    background: transparent;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    height: 18px;
    z-index: 2;
}
.demo-timeline .af-tl-slider::-webkit-slider-runnable-track {
    background: transparent;
    height: 2px;
}
.demo-timeline .af-tl-slider::-moz-range-track {
    background: transparent;
    height: 2px;
}
.demo-timeline .af-tl-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--foreground);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--foreground);
}
.demo-timeline .af-tl-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--foreground);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--foreground);
}

/* L'année à droite est cachée en desktop (les ticks suffisent) */
.demo-tl-year-mobile {
    display: none;
    font-weight: 700;
    color: var(--foreground);
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
    min-width: 3.5rem;
    text-align: right;
}

/* ============================================================
   FOND GRIS sur 100% largeur sous les onglets
   ============================================================ */
.demo-mainwrap {
    background: var(--muted);
    border-radius: 0;
    padding: 0;
    margin: 1.5rem 0 0;
    border: 0;
    border-top: 1px solid var(--border);
}
.demo-mainnav {
    background: transparent;
    border-bottom: 1px solid var(--border);
    margin: 0;
    padding: 0 1.5rem;
    gap: 0;
    max-width: none;
    /* On centre avec wrapping pour aligner avec le contenu en dessous */
}
/* Conteneur interne aux onglets : centré, max 1180px comme la carte */
.demo-mainnav::before { content: none; }

.demo-mainnav-btn {
    background: var(--background);     /* onglets inactifs = fond blanc */
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: calc(var(--radius) - 4px) calc(var(--radius) - 4px) 0 0;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    margin-bottom: -1px;
    margin-right: 0.25rem;
    top: 0.5rem;
    position: relative;
}
.demo-mainnav-btn:hover {
    background: var(--accent);
    color: var(--foreground);
}
/* Onglet actif : FOND GRIS (= fond du panel en dessous) */
.demo-mainnav-btn.is-active {
    background: var(--muted);
    color: var(--foreground);
    border-color: var(--border);
    border-bottom-color: var(--muted);
    font-weight: 600;
}

/* Panel actif : fond gris (identique au wrapper), padding intérieur */
.demo-mainpanel:not([hidden]) {
    background: transparent;     /* le fond du wrapper transparait */
    border: 0;
    border-radius: 0;
    padding: 1.5rem;
    max-width: 1180px;
    margin: 0 auto;
}

/* ============================================================
   GRILLE 4 BLOCS PARAMÈTRES
   ============================================================ */
.demo-params-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    align-items: stretch;
    max-width: none;
}
@media (max-width: 1100px) { .demo-params-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .demo-params-grid { grid-template-columns: 1fr; } }

/* Blocs paramètres : fond BLANC, sans ombre lourde, pour aérer sur fond gris */
.demo-block {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    box-shadow: none;
}
.demo-block__title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--foreground);
    margin: 0;
}

/* ============================================================
   BOUTON APPLIQUER au pied du panel (à droite)
   ============================================================ */
.demo-mainpanel__footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.5rem;
}
.demo-apply-btn-bottom {
    appearance: none;
    background: var(--primary);
    color: var(--primary-foreground);
    border: 1px solid var(--primary);
    border-radius: calc(var(--radius) - 4px);
    height: 2.25rem;
    padding: 0 1.25rem;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: opacity .15s, background .15s;
}
.demo-apply-btn-bottom:hover {
    background: #000;
    opacity: 1;
}
.demo-apply-btn-bottom .demo-apply-btn__indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: transparent;
    transition: background .15s;
}
.demo-apply-btn-bottom.is-pending .demo-apply-btn__indicator {
    background: var(--primary-foreground);
    animation: demo-apply-pulse 1s ease-in-out infinite;
}

/* ============================================================
   ONGLET DONNÉES : 2 blocs en haut (Années + Indicateurs)
   ============================================================ */
.demo-data-topgrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}
@media (max-width: 720px) {
    .demo-data-topgrid { grid-template-columns: 1fr; }
}

.demo-add-row--double {
    flex-wrap: wrap;
}
.demo-add-row--double input {
    max-width: none;
}
.demo-add-row--double > input:first-child { flex: 2; min-width: 8rem; }
.demo-add-row--double > input:nth-child(2) { flex: 1; min-width: 4rem; max-width: 6rem; }

/* Chips d'indicateurs : montrer aussi l'unité en plus du label */
.demo-chip__unit {
    color: var(--muted-foreground);
    font-size: 0.75rem;
    margin-left: 0.15rem;
}

/* ============================================================
   TABLEAU : ID/Pays/Année grisés + filets verticaux + alignements
   ============================================================ */
.demo-table th,
.demo-table td {
    border-right: 1px solid var(--border);
}
.demo-table th:last-child,
.demo-table td:last-child {
    border-right: 0;
}

/* Colonnes meta (ID, Pays, Année) : grisées et non éditables */
.demo-table .demo-th-readonly,
.demo-table .demo-td-readonly {
    background: var(--muted);
    color: var(--muted-foreground);
    user-select: text;
}
.demo-table .demo-td-readonly { font-size: 0.8125rem; }

/* Alignement : Pays/Année à GAUCHE, indicateurs à DROITE (cohérent avec
   l'alignement des valeurs numériques en dessous). */
.demo-table .demo-th-readonly,
.demo-table .demo-td-readonly {
    text-align: left;
}
.demo-table .demo-th-numeric {
    text-align: right;
    padding-right: 1rem;
    /* Espace pour le bouton × en haut à droite. position relative pour le bouton */
    position: relative;
}
.demo-table .demo-th-col__label {
    font-weight: 600;
    color: var(--foreground);
    font-size: 0.8125rem;
}
/* L'unité sous le nom de l'indicateur dans l'en-tête */
.demo-table .demo-th-col__unit {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--muted-foreground);
    text-transform: none;
    letter-spacing: 0;
}
/* Le bouton × dans l'en-tête : positionné absolu en haut à droite */
.demo-table .demo-th-col__remove {
    position: absolute;
    top: 0.4rem;
    right: 0.3rem;
}

/* Le row hover ne s'applique pas aux colonnes readonly (visuellement) */
.demo-table tr:hover .demo-td-readonly {
    background: var(--muted);
}

/* Inputs cellules : alignés à droite (numérique) */
.demo-cell-input { text-align: right; }

/* ============================================================
   ACTIONS sous le tableau : gauche + droite (Appliquer)
   ============================================================ */
.demo-table-actions {
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.demo-table-actions__left {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.demo-table-actions__right { display: flex; }

@media (max-width: 600px) {
    .demo-table-actions { flex-direction: column; align-items: stretch; }
    .demo-table-actions__right { justify-content: flex-end; }
}

/* ============================================================
   RESPONSIVE MAP HEADER (mobile : empilé)
   ============================================================ */
@media (max-width: 720px) {
    .demo-map-header {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1rem;
    }
    .demo-map-header__brand .demo-title { font-size: 1.25rem; }
    .demo-map-header__selectors {
        display: flex;
        gap: 0.6rem;
        width: 100%;
        align-items: flex-end;
    }
    .demo-map-header__selectors .demo-map-selector { flex: 1; min-width: 0; }

    /* Ordre mobile : titre, sous-titre, selects, carte (déjà dans le DOM dans cet ordre),
       puis légende sous la carte (la sidebar passe sous le SVG), puis timeline. */
    .demo-map-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    /* Mobile : on cache les ticks-année sous la timeline, on affiche l'année
       en lecture en gros à droite. */
    .demo-timeline__tick { color: transparent; padding-top: 6px; }
    .demo-tl-year-mobile { display: inline-flex; align-items: center; }
    .demo-timeline__track { height: 24px; }
    .demo-timeline__ticks { height: 12px; }
}

/* ============================================================
   v3 — CORRECTIONS BASÉES SUR FEEDBACK
   ============================================================ */

/* ---- Onglets : pas de fond gris derrière les onglets, juste sous le panel ----
   Les onglets flottent sur le fond blanc du body, alignés à gauche du contenu. */
.demo-mainwrap {
    background: transparent;     /* pas de gris global */
    border-top: 0;               /* pas de filet horizontal */
    margin-top: 1.5rem;
}

/* Conteneur d'onglets : transparent, aligné sur le max-width du contenu */
.demo-mainnav {
    background: transparent;
    border-bottom: 0;            /* pas de filet horizontal */
    padding: 0;
    margin: 0 auto;
    max-width: 1180px;           /* aligné avec le contenu en dessous */
    box-sizing: border-box;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    /* Décalage négatif pour que les onglets "flottent" et que le bord
       inférieur de l'onglet actif soit collé au bord supérieur du panel.
       Comme le panel a un fond gris, l'onglet actif (gris) fusionne. */
    margin-bottom: 0;
    position: relative;
    z-index: 2;
}

/* Onglets : fond blanc par défaut (= fond de la page), bordure légère */
.demo-mainnav-btn {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px) calc(var(--radius) - 4px) 0 0;
    margin-bottom: -1px;
    top: 0;
    margin-right: 0.3rem;
    color: var(--muted-foreground);
    font-weight: 500;
}
.demo-mainnav-btn:hover {
    background: var(--accent);
    color: var(--foreground);
}
/* Onglet actif : prend le fond gris (= fond du panel en dessous) */
.demo-mainnav-btn.is-active {
    background: var(--muted);
    color: var(--foreground);
    border-color: var(--border);
    border-bottom-color: var(--muted);
    font-weight: 600;
}

/* Panel : prend le fond gris uniquement quand il est visible */
.demo-mainpanel:not([hidden]) {
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: 0 var(--radius) var(--radius) var(--radius);
    padding: 1.5rem;
    margin: 0 auto;
    max-width: 1180px;
    box-sizing: border-box;
    /* L'onglet actif est aligné à gauche : la bordure haut-gauche est
       arrondie SEULEMENT si l'onglet actif n'est PAS le premier. Sinon
       on garde l'angle vif pour que le contour visuel s'aligne. */
}

/* ============================================================
   TABLEAU : bouton (×) en tête de colonne sans superposition
   ============================================================ */
/* On donne un peu de padding-right au th pour laisser de la place au ×,
   et on s'assure que le bouton est positionné EN HAUT À DROITE sans
   chevaucher le contenu. */
.demo-table .demo-th-numeric {
    padding-right: 1.75rem;       /* espace pour le bouton × */
    padding-top: 0.5rem;
    padding-bottom: 0.55rem;
    vertical-align: top;
}
.demo-table .demo-th-col__label {
    display: block;
    padding-right: 0;
}
.demo-table .demo-th-col__unit {
    display: block;
    margin-top: 0.15rem;
}
.demo-table .demo-th-col__remove {
    position: absolute;
    top: 0.4rem;
    right: 0.35rem;
    z-index: 2;
}

/* ============================================================
   TIMELINE : filet horizontal de la piste + ticks bien alignés + play noir
   ============================================================ */

/* Bouton play : NOIR (pas vert) */
.demo-timeline .af-tl-btn.demo-tl-play {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-foreground);
}
.demo-timeline .af-tl-btn.demo-tl-play:hover {
    background: #000;
    border-color: #000;
}

/* Track : restaurer le filet horizontal de la piste */
.demo-timeline__track {
    position: relative;
    height: 40px;
    /* La piste visible : un filet horizontal continu au centre vertical */
}
.demo-timeline__track::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border);
    border-radius: 1px;
    transform: translateY(-1px);
    pointer-events: none;
    z-index: 0;
}

/* Ticks verticaux : barrettes alignées avec les positions du slider,
   et libellé année dessous. Pour que les ticks tombent EXACTEMENT
   aux positions du thumb, les ticks doivent être positionnés en %
   en tenant compte de la largeur du thumb (14px). Le slider HTML
   natif positionne son thumb à v% * (track_width - thumb_width).
   On simule donc avec un padding-horizontal sur le container des ticks
   égal à la moitié de la taille du thumb. */
.demo-timeline__ticks {
    position: absolute;
    top: 0;
    left: 7px;        /* moitié du thumb pour alignement avec le slider */
    right: 7px;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}
.demo-timeline__tick {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    /* La barrette verticale est faite via ::before */
    width: 0;
    height: 0;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    text-align: center;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.demo-timeline__tick::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 12px;
    background: var(--border);
}
/* Le label de l'année sous le tick */
.demo-timeline__tick::after {
    content: attr(data-year);
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    color: inherit;
    font-size: 0.75rem;
    line-height: 1;
    white-space: nowrap;
}
.demo-timeline__tick.is-current {
    color: var(--foreground);
    font-weight: 700;
}
.demo-timeline__tick.is-current::before {
    background: var(--foreground);
    width: 2px;
}

/* Slider lui-même : on garde le thumb noir bien visible au-dessus des ticks */
.demo-timeline .af-tl-slider {
    z-index: 3;
}

/* ============================================================
   SÉLECTEUR DE DÉGRADÉ (menu select custom)
   ============================================================ */
.demo-gradient-select {
    position: relative;
}
.demo-gradient-select__trigger {
    appearance: none;
    width: 100%;
    background: var(--background);
    border: 1px solid var(--input);
    border-radius: calc(var(--radius) - 4px);
    padding: 0.5rem 0.75rem 0.5rem 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font: inherit;
    color: var(--foreground);
    transition: border-color .15s;
}
.demo-gradient-select__trigger:hover { border-color: var(--foreground); }
.demo-gradient-select__trigger:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}
.demo-gradient-select__trigger .demo-gradient-option__bar {
    flex: 1;
    min-width: 0;
}
.demo-gradient-select__trigger .demo-gradient-option__label {
    flex: 0 0 auto;
    color: var(--foreground);
    font-weight: 500;
}
.demo-gradient-select__caret {
    flex: 0 0 auto;
    color: var(--muted-foreground);
    font-size: 0.75rem;
}

/* Menu déroulant : option = barre pleine largeur + label en bas à gauche */
.demo-gradient-select__menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 50;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 360px;
    overflow: auto;
}
.demo-gradient-select__menu[hidden] { display: none; }

.demo-gradient-option {
    appearance: none;
    background: transparent;
    border: 1px solid transparent;
    border-radius: calc(var(--radius) - 4px);
    padding: 0.4rem 0.5rem 0.5rem;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: var(--foreground);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transition: background .15s, border-color .15s;
}
.demo-gradient-option:hover {
    background: var(--accent);
}
.demo-gradient-option.is-active {
    background: var(--accent);
    border-color: var(--foreground);
}
.demo-gradient-option__bar {
    display: block;
    width: 100%;
    height: 18px;
    border-radius: 4px;
    border: 1px solid var(--border);
}
.demo-gradient-option__label {
    display: block;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    font-weight: 500;
}
.demo-gradient-option.is-active .demo-gradient-option__label {
    color: var(--foreground);
}

/* On cache les anciennes vignettes de preset (qui étaient à plat) — au cas où */
.demo-presets-compact { display: none; }

/* ============================================================
   APPLICATION de page_bg_color et text_color sur la zone CARTE
   ============================================================ */
.demo-section--map {
    background: var(--demo-page-bg, transparent);
    color: var(--demo-text, var(--foreground));
    /* Étendu sur toute la largeur de la page : on retire le max-width
       hérité, mais on garde un padding interne pour le contenu. */
    max-width: none;
    padding: 1.5rem 0 0;
    margin: 0;
    transition: background .15s, color .15s;
}
/* Le contenu interne (header, carte, timeline) reste centré dans 1180px */
.demo-section--map > * {
    max-width: 1180px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    box-sizing: border-box;
}
.demo-section--map .demo-title,
.demo-section--map .demo-subtitle,
.demo-section--map .af-legend__title,
.demo-section--map .af-legend__unit,
.demo-section--map .af-legend-grad__label,
.demo-section--map .af-legend-grad__unit,
.demo-section--map .af-legend__item,
.demo-section--map .demo-map-selector > span,
.demo-section--map .demo-tl-year-mobile,
.demo-section--map .demo-timeline__tick {
    color: var(--demo-text, var(--foreground));
}
/* Les labels (.demo-timeline__tick::after) héritent via "color: inherit" ;
   les barrettes (::before) restent grises pour rester subtiles. */

/* Les selects Indicateur/Année dans le header : si fond sombre, on adapte */
.demo-section--map .demo-map-selector select {
    /* On garde le fond blanc des selects pour la lisibilité, le texte foncé
       fonctionne quoi qu'il arrive. */
}

/* ============================================================
   v5 — CORRECTIONS BASÉES SUR FEEDBACK
   ============================================================ */

/* ---- Panel des onglets : arrondir AUSSI le coin haut-gauche ----
   L'onglet "Paramètres" étant le premier, on veut un bord supérieur
   continu : panel + onglet actif forment un L arrondi à gauche. */
.demo-mainpanel:not([hidden]) {
    border-radius: var(--radius);
}

/* ---- Sub-field : étiquette + sous-options sous une option principale ---- */
.demo-sub-field {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding-top: 0.25rem;
    margin-top: 0.25rem;
    border-top: 1px solid var(--border);
}
.demo-sub-field[hidden] { display: none; }
.demo-sub-field__label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ---- Range value live (% / s) à droite du label ---- */
.demo-field__label .demo-range-value {
    float: right;
    font-weight: 400;
    color: var(--muted-foreground);
    font-variant-numeric: tabular-nums;
}

/* ---- Modes compact : 2 colonnes pour Fluide/Fragmenté ---- */
.demo-modes-compact--2 {
    grid-template-columns: 1fr 1fr;
}

/* ============================================================
   TIMELINE v5 — réécriture propre
   Tout est aligné via un padding horizontal de 7px sur le RAIL
   (moitié du thumb du slider natif), pour que ticks/labels tombent
   exactement sous les positions du thumb.
   ============================================================ */

.demo-timeline {
    --tl-thumb-size: 14px;
    --tl-thumb-half: 7px;
    margin-top: 1.25rem;
    padding: 0.5rem 0 0.25rem;
    background: transparent;
    border: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Bouton play : noir solide rond */
.demo-timeline .af-tl-btn.demo-tl-play {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-foreground);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.demo-timeline .af-tl-btn.demo-tl-play:hover {
    background: #000;
    border-color: #000;
}

/* Boutons prev/next : carrés discrets */
.demo-timeline .af-tl-btn.demo-tl-prev,
.demo-timeline .af-tl-btn.demo-tl-next {
    width: 28px;
    height: 28px;
    background: transparent;
    border: 0;
    color: var(--muted-foreground);
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.demo-timeline .af-tl-btn.demo-tl-prev:hover,
.demo-timeline .af-tl-btn.demo-tl-next:hover {
    color: var(--foreground);
    background: var(--accent);
}

/* Rail : contient ticks + slider + labels, avec padding pour alignement */
.demo-timeline__rail {
    flex: 1;
    position: relative;
    padding: 0 var(--tl-thumb-half);
    box-sizing: border-box;
    height: 48px;
    /* Filet horizontal continu au centre vertical */
}
.demo-timeline__rail::before {
    content: '';
    position: absolute;
    top: 12px;
    left: var(--tl-thumb-half);
    right: var(--tl-thumb-half);
    height: 2px;
    background: var(--border);
    border-radius: 1px;
    pointer-events: none;
    z-index: 0;
}

/* Ticks : graduations verticales positionnées en % dans le rail.
   Le padding du rail (7px) compense la course réduite du slider. */
.demo-timeline__ticks {
    position: absolute;
    top: 6px;
    left: var(--tl-thumb-half);
    right: var(--tl-thumb-half);
    height: 14px;
    pointer-events: none;
    z-index: 1;
}
.demo-timeline__tick {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    width: 2px;
    height: 14px;
    background: var(--border);
    border-radius: 1px;
}
.demo-timeline__tick.is-current {
    background: var(--foreground);
    height: 16px;
    top: -1px;
}

/* Slider : superposé aux ticks. Course alignée avec le padding du rail. */
.demo-timeline .af-tl-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 24px;
    margin: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    z-index: 2;
}
.demo-timeline .af-tl-slider::-webkit-slider-runnable-track {
    background: transparent;
    height: 24px;
}
.demo-timeline .af-tl-slider::-moz-range-track {
    background: transparent;
    height: 24px;
}
.demo-timeline .af-tl-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: var(--tl-thumb-size);
    height: var(--tl-thumb-size);
    border-radius: 50%;
    background: var(--foreground);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--foreground), 0 1px 3px rgb(0 0 0 / 0.2);
    margin-top: 5px;             /* aligner avec le filet à top:12px */
}
.demo-timeline .af-tl-slider::-moz-range-thumb {
    width: var(--tl-thumb-size);
    height: var(--tl-thumb-size);
    border-radius: 50%;
    background: var(--foreground);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--foreground), 0 1px 3px rgb(0 0 0 / 0.2);
}

/* Labels : année sous chaque tick, position en % alignée comme les ticks */
.demo-timeline__labels {
    position: absolute;
    top: 28px;
    left: var(--tl-thumb-half);
    right: var(--tl-thumb-half);
    height: 18px;
    pointer-events: none;
}
.demo-timeline__label {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: var(--muted-foreground);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    line-height: 1;
}
.demo-timeline__label.is-current {
    color: var(--foreground);
    font-weight: 700;
}

/* Année en lecture à droite : masquée sur desktop (les labels suffisent),
   visible sur mobile (où les labels sont cachés). */
.demo-tl-year-mobile {
    display: none;
    font-weight: 700;
    color: var(--foreground);
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
    min-width: 3.5rem;
    text-align: right;
}

/* ============================================================
   RESPONSIVE MOBILE — timeline
   ============================================================ */
@media (max-width: 720px) {
    .demo-timeline__labels { display: none; }      /* labels cachés */
    .demo-tl-year-mobile { display: inline-flex; align-items: center; }
    .demo-timeline__rail { height: 28px; }
    .demo-timeline__rail::before { top: 13px; }
    .demo-timeline__ticks { top: 6px; height: 14px; }
}

/* ============================================================
   EN-TÊTE TABLEAU — Nom et unité éditables
   ============================================================ */
.demo-th-col__label[contenteditable="true"],
.demo-th-col__unit[contenteditable="true"] {
    cursor: text;
    outline: none;
    border-radius: calc(var(--radius) - 6px);
    padding: 1px 4px;
    margin: -1px -4px;
    transition: background .12s, box-shadow .12s;
    min-width: 1.5rem;
    display: inline-block;
}
.demo-th-col__label[contenteditable="true"]:hover,
.demo-th-col__unit[contenteditable="true"]:hover {
    background: var(--card);
}
.demo-th-col__label[contenteditable="true"]:focus,
.demo-th-col__unit[contenteditable="true"]:focus {
    background: var(--card);
    box-shadow: 0 0 0 2px var(--muted), 0 0 0 4px var(--ring);
}

/* ============================================================
   v6 — TIMELINE refonte visuelle
   - Tout centré verticalement (filets, ticks, thumb, ligne)
   - Ligne plus épaisse, grise
   - Thumb pastille pleine sans double contour
   - Bouton play : animation pulse quand non-playing, icône pause sinon
   - Prev/Next : chevrons
   ============================================================ */

/* Hauteur fixe du composant pour alignement vertical cohérent */
.demo-timeline {
    --tl-thumb-size: 14px;
    --tl-thumb-half: 7px;
    --tl-rail-height: 44px;
    align-items: center;             /* tout centré verticalement */
    min-height: 44px;
}

/* Bouton play : NOIR rond, animation pulse de "respiration" quand pas en
   lecture pour inciter à cliquer. Désactivée une fois la lecture lancée. */
.demo-timeline .af-tl-btn.demo-tl-play {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-foreground);
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.4);
    animation: demo-tl-pulse 1.8s ease-out infinite;
    flex: 0 0 auto;
}
.demo-timeline .af-tl-btn.demo-tl-play:hover {
    background: #000;
    border-color: #000;
    animation-play-state: paused;
}
@keyframes demo-tl-pulse {
    /* Halo qui grandit et s'estompe — invitation au clic */
    0%   { box-shadow: 0 0 0 0 rgba(23, 23, 23, 0.4); }
    70%  { box-shadow: 0 0 0 12px rgba(23, 23, 23, 0); }
    100% { box-shadow: 0 0 0 0 rgba(23, 23, 23, 0); }
}
/* Pulse arrêtée pendant la lecture (le bouton montre alors une pause statique) */
.demo-timeline.is-playing .af-tl-btn.demo-tl-play,
.af-timeline.af-tl-playing .af-tl-btn.demo-tl-play {
    animation: none;
    box-shadow: none;
}
/* Switch d'icône play/pause */
.demo-tl-icon { display: none; }
.demo-tl-icon--play { display: inline-block; }
.demo-timeline.is-playing .demo-tl-icon--play,
.af-timeline.af-tl-playing .demo-tl-icon--play { display: none; }
.demo-timeline.is-playing .demo-tl-icon--pause,
.af-timeline.af-tl-playing .demo-tl-icon--pause { display: inline-block; }

/* Boutons prev/next : ronds discrets, chevrons fins */
.demo-timeline .af-tl-btn.demo-tl-prev,
.demo-timeline .af-tl-btn.demo-tl-next {
    width: 32px;
    height: 32px;
    background: transparent;
    border: 0;
    color: var(--muted-foreground);
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.demo-timeline .af-tl-btn.demo-tl-prev:hover,
.demo-timeline .af-tl-btn.demo-tl-next:hover {
    color: var(--foreground);
    background: var(--accent);
}

/* Rail : conteneur des 3 couches. Hauteur fixe pour pouvoir centrer
   verticalement le filet, les ticks et le thumb par rapport au même axe. */
.demo-timeline__rail {
    flex: 1;
    position: relative;
    padding: 0 var(--tl-thumb-half);     /* alignement avec le thumb */
    box-sizing: border-box;
    height: var(--tl-rail-height);
}
/* Le filet horizontal : épais, gris doux, parfaitement centré */
.demo-timeline__rail::before {
    content: '';
    position: absolute;
    top: 50%;
    left: var(--tl-thumb-half);
    right: var(--tl-thumb-half);
    height: 4px;                          /* plus épais (était 2) */
    background: var(--border);            /* gris doux */
    border-radius: 2px;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 0;
}

/* Ticks : barrettes verticales courtes, centrées sur l'axe du filet */
.demo-timeline__ticks {
    position: absolute;
    top: 0;
    left: var(--tl-thumb-half);
    right: var(--tl-thumb-half);
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}
.demo-timeline__tick {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 10px;
    background: var(--muted-foreground);  /* contraste léger avec le filet */
    border-radius: 1px;
    opacity: 0.55;
}
.demo-timeline__tick.is-current {
    background: var(--foreground);
    height: 14px;
    opacity: 1;
}

/* Slider : caché, on ne montre que son thumb. Course alignée avec le rail. */
.demo-timeline .af-tl-slider {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    width: 100%;
    height: var(--tl-thumb-size);
    margin: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    z-index: 2;
}
.demo-timeline .af-tl-slider::-webkit-slider-runnable-track {
    background: transparent;
    height: var(--tl-thumb-size);
}
.demo-timeline .af-tl-slider::-moz-range-track {
    background: transparent;
    height: var(--tl-thumb-size);
}
/* Thumb : pastille pleine sans bordure blanche, sans halo */
.demo-timeline .af-tl-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: var(--tl-thumb-size);
    height: var(--tl-thumb-size);
    border-radius: 50%;
    background: var(--foreground);
    border: 0;
    box-shadow: none;
    cursor: pointer;
    margin-top: 0;                         /* centrage natif suffisant */
}
.demo-timeline .af-tl-slider::-moz-range-thumb {
    width: var(--tl-thumb-size);
    height: var(--tl-thumb-size);
    border-radius: 50%;
    background: var(--foreground);
    border: 0;
    box-shadow: none;
    cursor: pointer;
}
.demo-timeline .af-tl-slider:focus { outline: none; }
.demo-timeline .af-tl-slider:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(23, 23, 23, 0.15);
}

/* Labels : sous le rail. Positionnés en absolute en page-percentage,
   alignés par le padding du conteneur (même mécanisme que les ticks). */
.demo-timeline__labels {
    position: absolute;
    top: calc(50% + 10px);                /* sous l'axe du filet */
    left: var(--tl-thumb-half);
    right: var(--tl-thumb-half);
    height: 18px;
    pointer-events: none;
}
.demo-timeline__label {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: var(--muted-foreground);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    line-height: 1;
}
.demo-timeline__label.is-current {
    color: var(--foreground);
    font-weight: 700;
}

/* Année à droite : visible uniquement sur mobile */
.demo-tl-year-mobile {
    display: none;
    font-weight: 700;
    color: var(--foreground);
    font-size: 0.9375rem;
    font-variant-numeric: tabular-nums;
    min-width: 3.5rem;
    text-align: right;
    align-self: center;
}

@media (max-width: 720px) {
    .demo-timeline__labels { display: none; }
    .demo-tl-year-mobile { display: inline-flex; align-items: center; }
    .demo-timeline { --tl-rail-height: 28px; }
}

/* ============================================================
   FIX : couleur de fond des pays
   - En mode cartogram (squares), les "pays" sont des carrés posés sur
     un fond. Pour que la couleur de fond soit visible, on l'applique
     comme background du wrapper SVG. Pour choropleth/symbols/circles,
     le path lui-même est colorié (déjà géré côté PHP via af_color_svg).
   ============================================================ */
.demo-section--map .af-svg-wrap.af-viz-squares {
    background: var(--af-bg-color, transparent);
    border-radius: var(--radius);
}
/* Pour les autres vizs, on garde le fond de la zone (page_bg_color) */

/* Et pour symbols/circles, le bg_color est appliqué au path mais pour la
   continuité visuelle on l'applique aussi comme fond du wrapper. */
.demo-section--map .af-svg-wrap.af-viz-symbols,
.demo-section--map .af-svg-wrap.af-viz-circles {
    background: var(--af-bg-color, transparent);
    border-radius: var(--radius);
}

/* ============================================================
   v7 — Cohérence couleur texte sur tous les éléments de la carte
   ============================================================ */

/* La variable --demo-text est définie en style inline sur .demo-section--map
   depuis demo.php. On l'utilise partout où il y a du contenu visuel sur
   la zone carte (timeline, légende, boutons) pour qu'elle suive la
   couleur de texte choisie par l'utilisateur (avec bascule auto sur
   fond sombre déjà gérée côté PHP). */

/* ─── TIMELINE : tous les éléments suivent --demo-text ─── */
.demo-section--map .demo-timeline,
.demo-section--map .demo-timeline__label {
    color: var(--demo-text, var(--foreground));
}

/* Filet horizontal (axe de la timeline) : couleur texte à 40% pour rester
   discret mais visible. background, pas color, donc on doit forcer. */
.demo-section--map .demo-timeline__rail::before {
    background: var(--demo-text, var(--foreground));
    opacity: 0.25;
}

/* Ticks verticaux : couleur texte à ~55% au repos, 100% pour le tick courant */
.demo-section--map .demo-timeline__tick {
    background: var(--demo-text, var(--foreground));
    opacity: 0.5;
}
.demo-section--map .demo-timeline__tick.is-current {
    background: var(--demo-text, var(--foreground));
    opacity: 1;
}

/* Labels années : déjà en `color` héritée, on force le bold sur courant */
.demo-section--map .demo-timeline__label {
    color: var(--demo-text, var(--foreground));
    opacity: 0.7;
}
.demo-section--map .demo-timeline__label.is-current {
    color: var(--demo-text, var(--foreground));
    opacity: 1;
    font-weight: 700;
}

/* Thumb du slider : pastille de couleur texte */
.demo-section--map .demo-timeline .af-tl-slider::-webkit-slider-thumb {
    background: var(--demo-text, var(--foreground));
}
.demo-section--map .demo-timeline .af-tl-slider::-moz-range-thumb {
    background: var(--demo-text, var(--foreground));
}

/* Bouton PLAY : fond = couleur du texte, icône = couleur de l'arrière-plan
   (inversion visuelle pour contraste). */
.demo-section--map .demo-timeline .af-tl-btn.demo-tl-play {
    background: var(--demo-text, var(--foreground));
    border-color: var(--demo-text, var(--foreground));
    color: var(--demo-page-bg, var(--background));
}
.demo-section--map .demo-timeline .af-tl-btn.demo-tl-play:hover {
    /* Garde la même couleur, juste l'animation pulse qui s'arrête (cf v6) */
    background: var(--demo-text, var(--foreground));
    border-color: var(--demo-text, var(--foreground));
}
/* L'animation pulse réutilise --demo-text avec opacity faible pour la onde
   (au lieu du noir hardcodé du v6) */
@keyframes demo-tl-pulse-themed {
    0%   { box-shadow: 0 0 0 0 currentColor; }
    70%  { box-shadow: 0 0 0 12px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}
.demo-section--map .demo-timeline .af-tl-btn.demo-tl-play {
    /* L'animation pulse définie en v6 utilise une couleur hardcodée ; on
       l'écrase ici avec une version qui utilise currentColor (= text). */
    animation: demo-tl-pulse-themed 1.8s ease-out infinite;
}

/* Chevrons prev/next : couleur texte */
.demo-section--map .demo-timeline .af-tl-btn.demo-tl-prev,
.demo-section--map .demo-timeline .af-tl-btn.demo-tl-next {
    color: var(--demo-text, var(--foreground));
    opacity: 0.75;
}
.demo-section--map .demo-timeline .af-tl-btn.demo-tl-prev:hover,
.demo-section--map .demo-timeline .af-tl-btn.demo-tl-next:hover {
    color: var(--demo-text, var(--foreground));
    opacity: 1;
    /* Background fond léger sur la couleur texte */
    background: var(--demo-text, var(--foreground));
    background-color: rgba(0, 0, 0, 0);   /* fallback sans theme */
}
/* Mieux : utiliser un mix gris doux du texte (10%) — pas de CSS color-mix
   universel encore, on fait simple avec opacity sur un overlay */

/* Année mobile à droite : couleur texte */
.demo-section--map .demo-tl-year-mobile {
    color: var(--demo-text, var(--foreground));
}

/* ─── ESPACE sous la timeline ─── */
.demo-section--map {
    /* Le padding-bottom donne une respiration entre la timeline et le bord
       du fond coloré (page_bg_color). Sans ça la timeline collait au bord. */
    padding-bottom: 2rem;
}
.demo-section--map .demo-timeline {
    margin-bottom: 0.5rem;
}

/* ─── LÉGENDE : couleur texte + plus de filet autour du dégradé ─── */
.demo-section--map .demo-legend-wrap .af-legend__title,
.demo-section--map .demo-legend-wrap .af-legend__unit,
.demo-section--map .demo-legend-wrap .af-legend-grad__label,
.demo-section--map .demo-legend-wrap .af-legend-grad__unit,
.demo-section--map .demo-legend-wrap .af-legend__item {
    color: var(--demo-text, var(--foreground));
}

/* Plus de filet de contour autour de la barre de dégradé de la légende */
.demo-section--map .demo-legend-wrap .af-legend-grad__bar {
    border: 0;
    /* Les coins arrondis restent (déjà à 6px en v1) */
}

/* ─── BOUTONS ZOOM / AUDIO : ronds, couleurs cohérentes ─── */
.demo-section--map .af-zoom-controls {
    /* Stack vertical existant — on garde, juste cohérence visuelle */
}
.demo-section--map .af-zoom-btn {
    /* RONDS, taille fixe pour cohérence */
    width: 32px;
    height: 32px;
    border-radius: 50%;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--demo-page-bg, var(--background));
    color: var(--demo-text, var(--foreground));
    border: 1px solid var(--demo-text, var(--border));
    transition: background .15s, color .15s, opacity .15s;
    opacity: 0.8;
}
.demo-section--map .af-zoom-btn:hover {
    opacity: 1;
    /* Inversion au hover : fond couleur texte, icône arrière-plan */
    background: var(--demo-text, var(--foreground));
    color: var(--demo-page-bg, var(--background));
}
/* Bouton son spécifique : même apparence */
.demo-section--map .af-zoom-btn.af-sound-btn {
    /* Hérite des règles génériques au-dessus */
}

/* ─── SÉLECTEUR DE DÉGRADÉ : barres avec mêmes coins arrondis que légende ─── */
.demo-gradient-select__trigger .demo-gradient-option__bar,
.demo-gradient-option__bar {
    /* Légende utilise border-radius 6px ; on aligne pour cohérence */
    border-radius: 6px;
}

/* ============================================================
   v8 — Corrections visuelles
   ============================================================ */

/* ---- Barre dégradé : rayons 30px partout (trigger + options) ---- */
.demo-gradient-select__trigger .demo-gradient-option__bar,
.demo-gradient-option__bar {
    border-radius: 30px;
}

/* ---- mix-blend-mode sur le SVG de la carte ----
   La variable --demo-blend-mode est posée sur .demo-section--map en style
   inline (depuis PHP). On l'applique sur l'élément <svg> à l'intérieur
   du wrapper. Cela mélange visuellement les pays (et leur contour) avec
   le fond, en respectant le mode CSS choisi (normal, multiply, etc.). */
.demo-section--map .af-svg-wrap svg {
    mix-blend-mode: var(--demo-blend-mode, normal);
}

/* ---- Bouton "Appliquer" en dehors des onglets ----
   La barre flotte sous le wrapper d'onglets, alignée avec son contenu. */
.demo-apply-bar {
    display: flex;
    justify-content: flex-end;
    max-width: 1180px;
    margin: 1rem auto 2rem;
    padding: 0 1.5rem;
    box-sizing: border-box;
}

/* ---- Timeline : filets verticaux simples, centrés sur la timeline ---- */
/* On simplifie : les ticks deviennent de simples barrettes courtes (8px),
   parfaitement centrées sur la ligne du filet horizontal, sans excroissance
   pour le tick courant (qui est juste plus opaque). */
.demo-timeline__tick {
    /* Override les règles précédentes : barrette droite simple */
    top: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 10px;
    opacity: 0.5;
    /* La couleur est déjà héritée de --demo-text via la règle v7 */
}
.demo-timeline__tick.is-current {
    height: 10px;       /* MÊME hauteur que les autres : on simplifie */
    opacity: 1;         /* juste plus visible */
}

/* Labels année : un peu plus bas pour respirer */
.demo-timeline__labels {
    /* Précédent : top: calc(50% + 10px) → on descend à 18px */
    top: calc(50% + 16px);
}


/* ============================================================
   v9 — Motif d'arrière-plan (vaguelettes, lignes, etc.)
   ============================================================ */

/* Le wrapper SVG doit être en position relative pour permettre au
   motif d'être positionné absolu par-dessus. (Au cas où ce ne serait
   pas déjà le cas dans style.css.) */
.demo-section--map .af-svg-wrap {
    position: relative;
}

/* Calque motif : couvre tout le wrapper, derrière le SVG de la carte
   (z-index < celui par défaut du SVG). La couleur des traits du SVG
   inline suit currentColor → text_color via l'héritage. Opacity à
   ~25% pour rester décoratif et ne pas concurrencer la carte. */
.demo-bg-pattern {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    color: var(--demo-text, var(--foreground));
    opacity: 0.22;
}
.demo-bg-pattern svg {
    width: 100%;
    height: 100%;
    display: block;
    /* Le motif est décoratif, pas concerné par le mix-blend-mode de la
       carte. On le neutralise spécifiquement pour qu'il garde son rendu
       indépendamment de l'effet appliqué au SVG de la carte. */
    mix-blend-mode: normal;
}

/* Le SVG de la carte doit être au-dessus du motif (z-index positif).
   La carte est dans .af-svg-wrap > svg (direct child SVG). */
.demo-section--map .af-svg-wrap > svg {
    position: relative;
    z-index: 1;
}

/* Les contrôles de zoom doivent aussi être au-dessus du motif */
.demo-section--map .af-svg-wrap .af-zoom-controls {
    z-index: 2;
}

/* ============================================================
   v10 — Support couleur "transparent" dans les swatches
   ============================================================ */

/* Damier CSS pour signifier "transparent". Appliqué :
   - explicitement via .is-transparent dans le popover
   - en arrière-plan permanent du swatch trigger : si la couleur posée
     en inline-style est "transparent", le damier transparaît naturellement.
   Pattern damier minuscule 6×6, gris pâle. */
.demo-color-popover__swatch.is-transparent,
.demo-color-trigger__swatch,
.demo-color-popover__swatch {
    background-image:
        linear-gradient(45deg, #d0d0d0 25%, transparent 25%),
        linear-gradient(-45deg, #d0d0d0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #d0d0d0 75%),
        linear-gradient(-45deg, transparent 75%, #d0d0d0 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
}
/* Quand un style inline pose une couleur non-transparente, ce style écrase
   le background-image du damier — le navigateur applique
   background-color: <color> EN PLUS du background-image, et background-color
   passe SOUS background-image. Pour que la couleur masque le damier, on
   doit forcer background-image: none quand une couleur opaque est définie.
   Sans JS, on ne peut pas savoir. SOLUTION : on retire le damier sur les
   swatches SAUF s'ils ont explicitement la classe is-transparent. */
.demo-color-popover__swatch:not(.is-transparent),
.demo-color-trigger__swatch {
    background-image: none;
}
/* Le swatch is-transparent du popover : on remet explicitement le damier. */
.demo-color-popover__swatch.is-transparent {
    background-image:
        linear-gradient(45deg, #d0d0d0 25%, transparent 25%),
        linear-gradient(-45deg, #d0d0d0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #d0d0d0 75%),
        linear-gradient(-45deg, transparent 75%, #d0d0d0 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
    background-color: #ffffff;
}

/* Pour les triggers : si la valeur stockée est "transparent", on ajoute
   .is-transparent en JS au rendu. Sans JS, l'utilisateur verra du blanc
   uni (acceptable comme fallback). */
.demo-color-trigger__swatch.is-transparent {
    background-image:
        linear-gradient(45deg, #d0d0d0 25%, transparent 25%),
        linear-gradient(-45deg, #d0d0d0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #d0d0d0 75%),
        linear-gradient(-45deg, transparent 75%, #d0d0d0 75%);
    background-size: 6px 6px;
    background-position: 0 0, 0 3px, 3px -3px, -3px 0px;
    background-color: #ffffff;
}

/* ============================================================
   v11 — Couleur par indicateur (chips du bloc Indicateurs)
   ============================================================ */

.demo-chip__color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.15);
    padding: 0;
    cursor: pointer;
    flex: 0 0 auto;
    margin-right: 0.4rem;
    transition: transform .12s, box-shadow .12s;
}
.demo-chip__color-dot:hover {
    transform: scale(1.15);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}
.demo-chip__color-dot:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

/* Input color natif partagé : invisible et hors flux, déclenché par .click(). */
.demo-chip__color-picker {
    position: absolute;
    width: 0;
    height: 0;
    border: 0;
    padding: 0;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}
