/* Vue 3D du magasin — interface claire et nette, aux couleurs Delhaize. */
.s3d-root {
    --red: #e22426;
    --red-dark: #b3141c;
    --ink: #16181d;
    --muted: #6a7385;
    --line: rgba(22, 24, 29, 0.09);
    --card: rgba(255, 255, 255, 0.9);
    --radius: 18px;
    --shadow: 0 1px 2px rgba(22, 30, 50, 0.06), 0 10px 30px rgba(22, 30, 50, 0.1);
    position: fixed;
    inset: 0;
    overflow: hidden;
    color: var(--ink);
    font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.35;
    background:
        radial-gradient(1100px 700px at 28% 18%, #ffffff 0%, rgba(255, 255, 255, 0) 70%),
        linear-gradient(160deg, #f3f6fa 0%, #e6ecf3 55%, #dbe3ed 100%);
    user-select: none;
}

.s3d-root *, .s3d-root *::before, .s3d-root *::after { box-sizing: border-box; }
.s3d-root button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.s3d-root [hidden] { display: none !important; }

.s3d-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; }
.s3d-overlay { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.s3d-hud { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.s3d-hud > * { pointer-events: auto; }

.s3d-card {
    background: var(--card);
    -webkit-backdrop-filter: blur(14px) saturate(1.3);
    backdrop-filter: blur(14px) saturate(1.3);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ── Barre du haut ── */
.s3d-top { position: absolute; top: 16px; left: 24px; right: 24px; display: flex; gap: 12px; align-items: stretch; pointer-events: none; }
.s3d-top > * { pointer-events: auto; }

.s3d-brand { display: flex; align-items: center; gap: 14px; padding: 10px 16px 10px 14px; border-top: 3px solid var(--red); }
.s3d-logo { display: block; flex: none; }
.s3d-brand-text { display: flex; flex-direction: column; padding-left: 14px; border-left: 1px solid var(--line); }
.s3d-brand-text strong { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.s3d-brand-text span { color: var(--muted); font-size: 12px; }
.s3d-demo { margin-left: 4px; padding: 4px 9px; border-radius: 999px; background: #fff3d6; color: #8a5a00; font-size: 11px; font-weight: 700; white-space: nowrap; cursor: help; }

.s3d-kpis { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 40px 12px; flex: 1; min-width: 0; height: 100px; margin-bottom: -26px; padding: 0 4px 0 0; overflow: hidden; }
.s3d-kpi { flex: none; height: 74px; }
.s3d-brand, .s3d-tools { flex: none; }
.s3d-kpi { display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 8px; padding: 8px 16px; min-width: 0; }
.s3d-kpi > span { grid-column: 1 / -1; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.s3d-kpi strong { font-size: 20px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.s3d-kpi .s3d-kpi-text { grid-column: 1 / -1; font-size: 16px; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.s3d-kpi em { font-style: normal; font-size: 12px; font-weight: 700; }
.s3d-kpi small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.s3d-up { color: #0f9d63; }
.s3d-down { color: var(--red); }
.s3d-flat { color: var(--muted); }

.s3d-tools { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-left: auto; }
.s3d-seg { display: flex; padding: 3px; border-radius: 12px; background: #eef1f6; }
.s3d-seg button { padding: 6px 12px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--muted); transition: background 0.15s, color 0.15s; }
.s3d-seg button.is-on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(22, 30, 50, 0.16); }
.s3d-toggles { display: flex; gap: 4px; }
.s3d-toggles button { padding: 6px 10px; border-radius: 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); }
.s3d-toggles button.is-on { color: var(--red-dark); background: #fdecec; border-color: rgba(226, 36, 38, 0.28); }
.s3d-toggles button:disabled { opacity: 0.4; cursor: default; }
.s3d-views { display: flex; gap: 2px; padding-left: 8px; border-left: 1px solid var(--line); }
.s3d-views button { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--muted); }
.s3d-views button:hover, .s3d-toggles button:hover:not(:disabled), .s3d-seg button:hover { color: var(--ink); }
.s3d-views button:hover { background: #eef1f6; }

/* ── Panneau de classement ── */
.s3d-side { position: absolute; top: 96px; right: 24px; bottom: 24px; width: 332px; display: flex; flex-direction: column; padding: 12px 6px 6px 12px; }
.s3d-tabs { display: flex; padding: 3px; margin-right: 6px; border-radius: 12px; background: #eef1f6; }
.s3d-tabs button { flex: 1; padding: 7px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.s3d-tabs button.is-on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(22, 30, 50, 0.16); }
.s3d-search { display: flex; align-items: center; gap: 8px; margin: 10px 6px 4px 0; padding: 0 12px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--muted); }
.s3d-search:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px rgba(226, 36, 38, 0.12); }
.s3d-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; color: var(--ink); user-select: text; }
.s3d-chip-row:empty { display: none; }
.s3d-chip-row { margin: 6px 6px 0 0; }
.s3d-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; background: #eef1f6; font-size: 12.5px; font-weight: 600; }
.s3d-chip svg { width: 14px; height: 14px; }

.s3d-list { list-style: none; margin: 8px 0 0; padding: 0 6px 0 0; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: #c9d0dc transparent; }
.s3d-list li { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; padding: 7px 8px 8px 4px; border-radius: 12px; cursor: pointer; }
.s3d-list li:hover { background: #f1f4f8; }
.s3d-list li.is-selected { background: #fdecec; }
.s3d-list li.s3d-empty { display: block; color: var(--muted); cursor: default; padding: 18px 8px; text-align: center; }
.s3d-rank { color: var(--muted); font-size: 12px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.s3d-row-main { min-width: 0; display: flex; flex-direction: column; }
.s3d-row-main b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s3d-row-main small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s3d-bar { display: block; height: 4px; margin-top: 5px; border-radius: 4px; background: #e9edf3; overflow: hidden; }
.s3d-bar span { display: block; height: 100%; border-radius: 4px; transition: width 0.35s ease; }
.s3d-val { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.s3d-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 0; flex: none; }

/* ── Fiche rayon ── */
.s3d-detail { position: absolute; top: 96px; left: 24px; width: 300px; padding: 16px; border-top: 3px solid var(--red); animation: s3d-pop 0.22s ease; }
@keyframes s3d-pop { from { opacity: 0; transform: translateY(6px); } }
.s3d-detail-head { display: flex; justify-content: space-between; gap: 8px; }
.s3d-eyebrow { color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.s3d-detail h2 { margin: 2px 0 0; font-size: 19px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; }
.s3d-detail-actions { display: flex; gap: 2px; flex: none; }
.s3d-detail-actions button { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: var(--muted); }
.s3d-detail-actions button:hover { background: #eef1f6; color: var(--ink); }
.s3d-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0 12px; }
.s3d-tags span { padding: 3px 8px; border-radius: 999px; background: #eef1f6; font-size: 11.5px; font-weight: 600; color: #48505f; }
.s3d-note { margin: 0 0 10px; padding: 7px 10px; border-radius: 10px; background: #fff3d6; color: #8a5a00; font-size: 12px; }
.s3d-figures { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.s3d-figures div { padding: 9px 11px; border-radius: 12px; background: #f4f6f9; }
.s3d-figures span { display: block; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.s3d-figures strong { font-size: 18px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.s3d-figures small { color: var(--muted); font-size: 12px; font-weight: 600; }
.s3d-trend { display: flex; flex-direction: column; margin-top: 14px; }
.s3d-trend span { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.s3d-trend em { font-style: normal; font-size: 12.5px; font-weight: 700; }
.s3d-spark { display: block; width: 100%; height: 56px; margin-top: 6px; overflow: visible; }
.s3d-foot { margin: 8px 0 0; color: var(--muted); font-size: 12px; }

/* ── Légende ── */
.s3d-legend { position: absolute; left: 24px; bottom: 172px; width: 236px; padding: 10px 14px 9px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.s3d-legend-bar { height: 8px; margin: 7px 0 5px; border-radius: 6px; }
.s3d-legend-scale { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }

/* ── Frise des jours ── */
.s3d-time { position: absolute; left: 24px; right: 380px; bottom: 24px; height: 136px; padding: 12px 16px 10px; display: flex; flex-direction: column; gap: 8px; }
.s3d-time-head { display: flex; align-items: center; gap: 14px; }
.s3d-time-nav { display: flex; align-items: center; gap: 4px; }
.s3d-time-nav button { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--ink); background: #eef1f6; }
.s3d-time-nav button:hover { background: #e2e7ee; }
.s3d-time-nav .s3d-play { width: 40px; height: 40px; background: var(--red); color: #fff; box-shadow: 0 4px 12px rgba(226, 36, 38, 0.35); }
.s3d-time-nav .s3d-play:hover { background: var(--red-dark); }
.s3d-time-date { display: flex; flex-direction: column; }
.s3d-time-date strong { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.s3d-time-date span, .s3d-time-range { color: var(--muted); font-size: 12px; }
.s3d-time-range { margin-left: auto; font-variant-numeric: tabular-nums; }
.s3d-chart { flex: 1; width: 100%; min-height: 0; cursor: ew-resize; touch-action: none; }

/* ── Infobulle, épingles, aide ── */
.s3d-tip { position: absolute; top: 0; left: 0; z-index: 20; pointer-events: none !important; display: flex; flex-direction: column; gap: 2px; max-width: 280px; padding: 9px 12px; border-radius: 12px; background: rgba(22, 24, 29, 0.94); color: #fff; font-size: 12.5px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); }
.s3d-tip b { font-size: 13.5px; }
.s3d-tip-sub { color: #b9c0cc; font-size: 11.5px; }
.s3d-tip-row { display: flex; align-items: baseline; gap: 8px; margin-top: 3px; }
.s3d-tip-row em { font-style: normal; font-size: 17px; font-weight: 750; }
.s3d-tip-row small { color: #b9c0cc; }

.s3d-pin { display: flex; align-items: center; gap: 7px; padding: 4px 11px 4px 4px; margin-bottom: 9px; border-radius: 999px; background: #fff; box-shadow: 0 6px 18px rgba(22, 30, 50, 0.22); font-size: 12px; white-space: nowrap; position: relative; }
.s3d-pin::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; background: #fff; transform: translateX(-50%) rotate(45deg); border-radius: 2px; }
.s3d-pin-rank { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 800; font-size: 12px; }
.s3d-pin-body { display: flex; flex-direction: column; line-height: 1.15; }
.s3d-pin-body b { font-weight: 750; font-variant-numeric: tabular-nums; }
.s3d-pin-body i { font-style: normal; color: var(--muted); font-size: 10.5px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }

.s3d-who { padding: 2px 9px; margin-bottom: 4px; border-radius: 999px; background: #16181d; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25); }

.s3d-hint { position: absolute; left: 272px; bottom: 174px; padding: 4px 11px; border-radius: 999px; background: rgba(255, 255, 255, 0.78); color: #6a7385; font-size: 11.5px; pointer-events: none !important; }

/* ── Chargement ── */
.s3d-loading { position: absolute; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 14px; background: #eef2f7; color: var(--muted); font-weight: 600; transition: opacity 0.45s ease; }
.s3d-loading.is-done { opacity: 0; pointer-events: none; }
.s3d-loading span { width: 38px; height: 38px; border-radius: 50%; border: 4px solid #d5dce6; border-top-color: var(--red); animation: s3d-spin 0.8s linear infinite; }
.s3d-loading p { margin: 0; }
.s3d-error { color: var(--red-dark); max-width: 420px; text-align: center; }
@keyframes s3d-spin { to { transform: rotate(360deg); } }

/* ── Écrans étroits ── */
@media (max-width: 1560px) {
    .s3d-toggles button { padding: 6px 8px; }
}
@media (max-width: 1100px) {
    .s3d-side, .s3d-hint, .s3d-kpis { display: none; }
    .s3d-time { right: 24px; }
    .s3d-top { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
    .s3d-root * { animation: none !important; transition: none !important; }
}
