/* Back-office ecom-cms — système tiré du skill design-dashboard-saas (assets/app.css) :
   grille de 4 px, texte 12/14/16/20/24 et deux graisses, un seul accent (action principale, sélection, focus, liens),
   couleurs de sens (vert, orange, rouge) seulement pour le sens et toujours avec un libellé, bordures plutôt qu'ombres,
   mode sombre par surfaces plus claires (jamais une inversion). */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --surface-3: #ffffff;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #475467;
  --text-3: #667085;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-pressed: #3730a3;
  --accent-ink: #ffffff;
  --accent-tint: #eef2ff;
  --success: #12805c;
  --success-bg: #e7f6ef;
  --warning: #b54708;
  --warning-bg: #fef4e6;
  --danger: #d92d20;
  --danger-bg: #fef0ef;
  --bar: #98a2b3;
  --shadow-pop: 0 8px 24px rgb(16 24 40 / 0.12);
  --shadow-modal: 0 16px 48px rgb(16 24 40 / 0.18);
  --focus: 0 0 0 3px rgb(79 70 229 / 0.22);
  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;
  --side: 232px;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0e1014; --surface: #16191f; --surface-2: #1f232b; --surface-3: #252a33; --border: #2a2f38; --border-strong: #3a404b;
    --text: #f2f4f7; --text-2: #b4bcc8; --text-3: #8a93a3; --accent: #8b8cf8; --accent-hover: #a3a4fb; --accent-pressed: #babbfd;
    --accent-ink: #11113a; --accent-tint: rgb(139 140 248 / 0.15); --success: #3ccb8f; --success-bg: rgb(60 203 143 / 0.12);
    --warning: #f5b54a; --warning-bg: rgb(245 181 74 / 0.12); --danger: #ff6b61; --danger-bg: rgb(255 107 97 / 0.12); --bar: #5f6878;
    --shadow-pop: 0 0 0 1px var(--border-strong); --shadow-modal: 0 0 0 1px var(--border-strong); --focus: 0 0 0 3px rgb(139 140 248 / 0.3);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0e1014; --surface: #16191f; --surface-2: #1f232b; --surface-3: #252a33; --border: #2a2f38; --border-strong: #3a404b;
  --text: #f2f4f7; --text-2: #b4bcc8; --text-3: #8a93a3; --accent: #8b8cf8; --accent-hover: #a3a4fb; --accent-pressed: #babbfd;
  --accent-ink: #11113a; --accent-tint: rgb(139 140 248 / 0.15); --success: #3ccb8f; --success-bg: rgb(60 203 143 / 0.12);
  --warning: #f5b54a; --warning-bg: rgb(245 181 74 / 0.12); --danger: #ff6b61; --danger-bg: rgb(255 107 97 / 0.12); --bar: #5f6878;
  --shadow-pop: 0 0 0 1px var(--border-strong); --shadow-modal: 0 0 0 1px var(--border-strong); --focus: 0 0 0 3px rgb(139 140 248 / 0.3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 14px/20px var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 20px; line-height: 28px; letter-spacing: -0.02em; }
h2 { font-size: 16px; line-height: 24px; }
h3 { font-size: 14px; line-height: 20px; }
p { margin: 0; }
code, kbd, .mono { font-family: var(--mono); font-size: 12px; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: var(--r-sm); overflow-wrap: anywhere; }
.muted { color: var(--text-3); }
.small { font-size: 12px; line-height: 16px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-end { justify-content: flex-end; }
.between { justify-content: space-between; }
.push { margin-left: auto; }
.stack { display: grid; gap: 16px; align-content: start; }
.stack-sm { display: grid; gap: 8px; align-content: start; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.ico { display: inline-grid; place-items: center; flex: none; }
.ico svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-tint); }

/* ---------- Contrôles ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 32px; padding: 0 12px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); border-radius: var(--r); font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
  white-space: nowrap; transition: background 0.12s, border-color 0.12s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(0.5px); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.5; cursor: default; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:active { background: var(--accent-pressed); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; gap: 6px; }
.btn-danger { color: var(--danger); }
.btn.busy::before { content: ''; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin 0.8s linear infinite; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; background: transparent; border-radius: var(--r); color: var(--text-3); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.input, .select, .textarea { width: 100%; height: 32px; padding: 0 12px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--r); min-width: 0; font-size: 14px; }
.select { padding: 0 8px; }
.textarea { height: auto; padding: 8px 12px; line-height: 20px; resize: vertical; }
.textarea.code { font-family: var(--mono); font-size: 12px; line-height: 18px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.input-sm, .select-sm { height: 28px; font-size: 12px; }
.select-auto { width: auto; }
.field { display: grid; gap: 6px; align-content: start; }
.field > label, .field > .label { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; line-height: 16px; color: var(--text-3); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.fields .full { grid-column: 1 / -1; }
.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.check input { margin-top: 2px; }
input[type='checkbox'], input[type='radio'] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; cursor: pointer; flex: none; }
kbd { display: inline-block; min-width: 20px; padding: 0 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: var(--r-sm); line-height: 18px; text-align: center; color: var(--text-2); background: var(--surface); }
.status-msg { font-size: 12px; color: var(--text-3); }
.status-msg.err { color: var(--danger); }
.status-msg.ok { color: var(--success); }

.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: var(--r-sm); font-size: 12px; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.badge-ok { background: var(--success-bg); color: var(--success); }
.badge-warn { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-accent { background: var(--accent-tint); color: var(--accent); }
.badge-muted { background: var(--surface-2); color: var(--text-2); }
.spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin 0.8s linear infinite; flex: none; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: 0.01ms !important; transition: none !important; } }

.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid transparent; border-radius: var(--r); background: transparent;
  color: var(--text-2); font-size: 12px; font-weight: 600; cursor: pointer; }
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed='true'] { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.chip-n { font-variant-numeric: tabular-nums; color: var(--text-3); font-weight: 400; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--r); overflow: hidden; }
.seg button { height: 30px; padding: 0 12px; border: 0; background: var(--surface); color: var(--text-2); cursor: pointer; font-size: 12px; font-weight: 600; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed='true'] { background: var(--accent-tint); color: var(--accent); }

/* ---------- Coquille ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 16px; padding: 16px 12px; border-right: 1px solid var(--border); background: var(--surface); overflow: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.brand-mark { width: 28px; height: 28px; border-radius: var(--r); background: var(--accent); display: grid; place-items: center; color: var(--accent-ink); }
.side-nav { display: grid; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 8px; border-radius: var(--r); color: var(--text-2); font-size: 14px; font-weight: 600; text-decoration: none; }
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item[aria-current='page'] { background: var(--accent-tint); color: var(--accent); }
.nav-item .label { flex: 1; }
.nav-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 12px; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.nav-count:empty { display: none; }
.side-foot { margin-top: auto; display: grid; gap: 2px; padding-top: 12px; border-top: 1px solid var(--border); }
.side-foot .nav-item { font-weight: 400; height: 32px; border: 0; background: none; width: 100%; cursor: pointer; text-align: left; }
.side-scrim { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 8px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.menu-btn { display: none; }
.scope { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.scope .select { width: auto; max-width: 280px; }
.search-btn { margin-left: auto; color: var(--text-3); font-weight: 400; min-width: 200px; justify-content: flex-start; }
.search-btn kbd { margin-left: auto; }
.page { padding: 24px 24px 96px; max-width: 1280px; width: 100%; }
.view { display: grid; gap: 24px; align-content: start; }
.view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.view-sub { margin-top: 4px; color: var(--text-3); max-width: 76ch; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; margin-top: -8px; }
.tab { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px; border-bottom: 2px solid transparent; color: var(--text-3); font-weight: 600; white-space: nowrap; margin-bottom: -1px; text-decoration: none; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab[aria-current='page'] { color: var(--text); border-bottom-color: var(--accent); }
.tab .chip-n { font-size: 12px; }

/* ---------- Cartes et panneaux ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { flex: 1; min-width: 0; }
.card-sub { color: var(--text-3); margin: -12px 0 16px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.panel-head h2 { flex: 1; min-width: 0; }
.panel-body { padding: 16px; }
.panel-note { padding: 12px 16px; font-size: 12px; line-height: 16px; color: var(--text-3); }
.panel-foot { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.callout { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--r); padding: 12px 16px; background: var(--warning-bg); color: var(--text); }
.callout > .ico { color: var(--warning); margin-top: 2px; }
.callout-info { background: var(--accent-tint); }
.callout-info > .ico { color: var(--accent); }
.callout-danger { background: var(--danger-bg); }
.callout-danger > .ico { color: var(--danger); }
.callout .grow { flex: 1; min-width: 0; }

/* ---------- Chiffres ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px 20px; display: grid; gap: 4px; align-content: start; min-width: 0; }
.kpi-label { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--text-2); }
.kpi-value { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-value.na { color: var(--text-3); font-size: 16px; font-weight: 400; letter-spacing: 0; }
.kpi-lines { display: grid; gap: 2px; font-size: 20px; line-height: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-cmp { font-size: 12px; line-height: 16px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.kpi-def { font-size: 12px; line-height: 16px; color: var(--text-3); margin-top: 4px; }
.up { color: var(--success); }
.down { color: var(--danger); }
.excluded { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); }
.excluded a { color: var(--text-2); font-weight: 600; }
.excluded b { font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------- À faire ---------- */
.todo { display: grid; }
.todo-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); color: var(--text); text-decoration: none; }
.todo-row:first-child { border-top: 0; }
.todo-row:hover { background: var(--surface-2); text-decoration: none; }
.todo-ico { width: 32px; height: 32px; border-radius: var(--r); display: grid; place-items: center; background: var(--warning-bg); color: var(--warning); }
.todo-ico.calm { background: var(--surface-2); color: var(--text-2); }
.todo-n { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; margin-right: 4px; }
.todo-text small { display: block; font-size: 12px; color: var(--text-3); }
.todo-done { display: flex; gap: 12px; align-items: center; padding: 16px; }
.todo-done .ico { width: 32px; height: 32px; border-radius: var(--r); background: var(--success-bg); color: var(--success); display: grid; place-items: center; }

/* ---------- Parcours ---------- */
.funnel { display: grid; gap: 0; }
.step { display: grid; grid-template-columns: minmax(180px, 1.3fr) minmax(0, 2fr) 72px 88px; gap: 16px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); }
.step:first-child { border-top: 0; }
.step-name b { display: block; font-weight: 600; }
.step-name small { display: block; font-size: 12px; line-height: 16px; color: var(--text-3); }
.step-track { height: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.step-track span { display: block; height: 100%; background: var(--accent); border-radius: 6px; min-width: 2px; }
.step-n { font-size: 20px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.step-pct { text-align: right; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.step-pct small { display: block; color: var(--text-3); }

/* ---------- Graphiques ---------- */
.chart { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; height: 168px; }
.chart-axis { display: flex; flex-direction: column; justify-content: space-between; font-size: 12px; color: var(--text-3); text-align: right; padding-bottom: 20px; font-variant-numeric: tabular-nums; }
.bars { display: grid; gap: 4px; align-items: end; border-bottom: 1px solid var(--border-strong); background: linear-gradient(var(--border) 1px, transparent 1px) 0 0 / 100% 50%; position: relative; height: calc(100% - 20px); }
.bar-col { position: relative; height: 100%; display: flex; align-items: flex-end; }
.bar { width: 100%; background: var(--bar); border-radius: 2px 2px 0 0; transition: opacity 0.15s; }
.bar.accent { background: var(--accent); }
.bars:hover .bar { opacity: 0.45; }
.bars .bar-col:hover .bar { opacity: 1; }
.bar-day { position: absolute; bottom: -20px; left: -8px; right: -8px; text-align: center; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-tip { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); font-size: 12px; line-height: 16px; padding: 4px 8px; border-radius: var(--r-sm); white-space: nowrap; pointer-events: none; opacity: 0; z-index: 2; }
.bar-col:hover .bar-tip, .bar-col:focus .bar-tip { opacity: 1; }
.insight { font-size: 14px; color: var(--text-2); margin-top: 12px; }
.hbars { display: grid; gap: 2px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(48px, 30%) 56px; gap: 12px; align-items: center; min-height: 32px; }
.hbar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.hbar-track span { display: block; height: 100%; background: var(--bar); }
.hbar-n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.hbar-n small { font-weight: 400; color: var(--text-3); }

/* ---------- Tableaux ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--text-3); padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.tbl th.num { text-align: right; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.link { cursor: pointer; }
.tbl tbody tr.link:hover td { background: var(--surface-2); }
.tbl tbody tr.selected td { background: var(--accent-tint); }
.tbl .sub { display: block; font-size: 12px; line-height: 16px; color: var(--text-3); }
.tbl .w-check { width: 40px; }
.tbl .input-sm, .tbl .select-sm { width: auto; }
.thumb { width: 40px; height: 40px; border-radius: var(--r); object-fit: cover; background: var(--surface-2); flex: none; display: block; }
.cell-prod { display: flex; gap: 12px; align-items: center; min-width: 220px; }
.cell-prod > div { min-width: 0; }
.cell-prod b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 12px; }
.list { display: grid; }
.list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); align-items: center; }
.list-row:first-child { border-top: 0; }

/* ---------- Fil ---------- */
.feed { display: grid; }
.feed-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); align-items: center; }
.feed-row:first-child { border-top: 0; }
.feed-time { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.feed-what b { font-weight: 600; }
.feed-what small { display: block; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-where { font-size: 12px; color: var(--text-2); text-align: right; white-space: nowrap; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); display: inline-block; box-shadow: 0 0 0 0 rgb(18 128 92 / 0.5); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 6px rgb(18 128 92 / 0); } 100% { box-shadow: 0 0 0 0 rgb(18 128 92 / 0); } }

/* ---------- États ---------- */
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 40px 24px; color: var(--text-3); }
.empty b { color: var(--text); font-weight: 600; }
.empty p { max-width: 56ch; }
.empty .btn { margin-top: 8px; }
.na-line { font-size: 12px; color: var(--text-3); }
.skel { display: grid; gap: 12px; }
.skel i { display: block; height: 16px; border-radius: var(--r-sm); background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skel i.big { height: 72px; border-radius: var(--r-lg); }
@keyframes shimmer { to { background-position: -200% 0; } }
.error-box { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: var(--r-lg); background: var(--danger-bg); }
.error-box .ico { color: var(--danger); }

/* ---------- Fenêtres, tiroir, toast, palette ---------- */
.modal { border: 0; padding: 0; border-radius: 16px; background: var(--surface); color: var(--text); width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 48px); box-shadow: var(--shadow-modal); }
.modal.wide { width: min(920px, calc(100vw - 24px)); }
.modal::backdrop { background: rgb(16 24 40 / 0.45); }
.modal-in { padding: 24px; display: grid; gap: 16px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-head .sub { font-size: 12px; color: var(--text-3); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; align-items: center; }
.drawer { position: fixed; z-index: 50; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-modal); animation: slide 0.18s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.drawer-scrim { position: fixed; inset: 0; z-index: 45; background: rgb(16 24 40 / 0.3); }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer-head .grow { flex: 1; min-width: 0; }
.drawer-head .sub { font-size: 12px; color: var(--text-3); }
.drawer-body { flex: 1; overflow: auto; padding: 16px 20px 32px; display: grid; gap: 20px; align-content: start; }
.drawer-sec { display: grid; gap: 8px; }
.drawer-sec > h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--text-3); font-size: 12px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.line-item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 12px; }
.timeline li { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px; color: var(--text-2); }
.toast-zone { position: fixed; z-index: 90; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-radius: var(--r-lg); background: var(--text); color: var(--bg); font-size: 14px; box-shadow: var(--shadow-modal);
  max-width: calc(100vw - 32px); animation: rise 0.18s ease-out; pointer-events: auto; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.palette { position: fixed; z-index: 85; top: 12vh; left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 24px)); background: var(--surface-3); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-pop); overflow: hidden; }
.palette-scrim { position: fixed; inset: 0; z-index: 84; background: rgb(16 24 40 / 0.3); }
.palette input { width: 100%; height: 48px; border: 0; border-bottom: 1px solid var(--border); padding: 0 16px; background: transparent; outline: none; font-size: 16px; }
.palette-list { max-height: 50vh; overflow: auto; padding: 4px; }
.palette-title { padding: 8px 10px 4px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.palette-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 6px 10px; border: 0; background: transparent; border-radius: var(--r-sm); cursor: pointer; text-align: left; color: var(--text); }
.palette-item small { color: var(--text-3); margin-left: auto; font-size: 12px; }
.palette-item[aria-selected='true'], .palette-item:hover { background: var(--surface-2); }

/* ---------- Catalogue, sourcing ---------- */
.src-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.src-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; display: grid; grid-template-rows: auto 1fr; }
.src-card.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-tint); }
.src-card.imported { opacity: 0.62; }
.src-card > img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface-2); display: block; }
.src-check { position: absolute; top: 8px; left: 8px; background: var(--surface); border-radius: var(--r-sm); padding: 6px; box-shadow: var(--shadow-pop); }
.src-body { padding: 12px; display: grid; gap: 4px; align-content: start; }
.src-title { font-size: 14px; font-weight: 600; line-height: 20px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 40px; }
.src-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-3); }
.review { border: 1px solid var(--border); border-radius: var(--r); padding: 12px 16px; display: grid; gap: 6px; background: var(--surface); }
.stars { color: #d97706; letter-spacing: 1px; }
.review-imgs { display: flex; gap: 6px; flex-wrap: wrap; }
.review-imgs img { width: 56px; height: 56px; object-fit: cover; border-radius: var(--r-sm); }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.choice { position: relative; display: grid; gap: 6px; padding: 12px; border: 1px solid var(--border-strong); border-radius: var(--r); cursor: pointer; font-size: 14px; }
.choice small { color: var(--text-3); font-size: 12px; line-height: 16px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }
.choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.mock { height: 28px; border-radius: var(--r-sm); background: var(--surface-2); display: flex; align-items: center; padding: 0 8px; gap: 6px; }
.mock i { display: block; height: 6px; border-radius: 3px; background: var(--border-strong); }
.mock b { display: block; height: 10px; width: 24px; border-radius: 3px; background: var(--text-2); }
.counter { font-weight: 400; color: var(--text-3); }
.counter.bad { color: var(--warning); }
.counter.good { color: var(--success); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(380px, 100%); display: grid; gap: 16px; }

/* ---------- Écrans moyens et petits ---------- */
@media (max-width: 1100px) {
  .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid3 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-102%); transition: transform 0.2s ease; box-shadow: var(--shadow-modal); }
  body.side-open .side { transform: none; }
  body.side-open .side-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgb(16 24 40 / 0.4); }
  .nav-item { height: 44px; }
  .menu-btn { display: inline-grid; width: 40px; height: 40px; }
  .topbar { padding: 8px 12px; }
  .search-btn { min-width: 0; width: 40px; padding: 0; justify-content: center; }
  .search-btn > span:not(.ico), .search-btn kbd { display: none; }
  .page { padding: 16px 16px 96px; }
  .grid2, .fields, .kpis { grid-template-columns: minmax(0, 1fr); }
  .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .step { grid-template-columns: minmax(0, 1fr) 64px 72px; }
  .step-track { grid-column: 1 / -1; grid-row: 2; }
  .btn { height: 40px; }
  .btn-sm { height: 32px; }
  .input, .select { height: 40px; font-size: 16px; }
  .input-sm, .select-sm { height: 32px; font-size: 14px; }
  .hide-sm { display: none; }
  .drawer { width: 100vw; }
  .timeline li { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 520px) {
  .kpis-4 { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 12px 16px; }
  .kpi-value { font-size: 20px; line-height: 28px; }
  .scope { flex: 1; }
  .scope .select { flex: 1; max-width: none; min-width: 0; }
  .feed-row { grid-template-columns: 48px minmax(0, 1fr); }
  .feed-where { grid-column: 2; text-align: left; }
  .hbar { grid-template-columns: minmax(0, 1fr) 72px 48px; }
}
.hbar-name a { color: var(--text); }
.hbar-name a:hover { color: var(--accent); }
.stack > .seg, .row > .seg { justify-self: start; }
.tbl-fixed { table-layout: fixed; }
.tbl-fixed td, .tbl-fixed th { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) { .tbl-fixed { table-layout: auto; } }
/* Les grilles à une colonne ne s'élargissent jamais au contenu (tableaux larges = défilement dans leur cadre). */
.view, .stack, .stack-sm { grid-template-columns: minmax(0, 1fr); }
.excluded { display: block; }
.excluded > .ico { display: inline-grid; vertical-align: -3px; margin-right: 6px; }
.excluded > a { margin-left: 8px; white-space: nowrap; }
.tbl tbody tr.link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tbl tbody tr.link:focus-visible td { background: var(--surface-2); }
.top-title { display: none; font-weight: 600; }
@media (max-width: 520px) {
  .top-title { display: block; flex: 1; }
  .scope { order: 3; flex-basis: 100%; }
  .step-pct .of { display: none; }
}

/* ---------- Vue en direct : le globe sur fond de nuit (dans les deux thèmes), les chiffres à côté ---------- */
.live { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 16px; align-items: start; background: var(--bg); }
.live-scene { position: sticky; top: 72px; width: 100%; aspect-ratio: 1 / 1; max-height: calc(100vh - 88px); background: radial-gradient(120% 90% at 30% 20%, #111a36 0%, #070b18 70%); border-radius: var(--r-lg); overflow: hidden; }
.live-scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.live-scene canvas:active { cursor: grabbing; }
.live-scene canvas:focus-visible { outline: 2px solid #8b8cf8; outline-offset: -4px; border-radius: var(--r-lg); }
.live-legend { position: absolute; left: 16px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0; list-style: none; color: #c7d2e8; font-size: 12px; line-height: 16px; pointer-events: none; }
.live-legend i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; }
.lp-visitor { background: #60a5fa; box-shadow: 0 0 8px #60a5fa; }
.lp-order { background: #34d399; box-shadow: 0 0 8px #34d399; }
.lp-out { background: #94a3b8; }
.live-note { position: absolute; left: 16px; right: 16px; top: 12px; color: #c7d2e8; font-size: 12px; line-height: 16px; pointer-events: none; }
.live-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.live-now { display: grid; gap: 4px; }
/* Seul chiffre du back-office au-delà de 24 px : cet écran se lit de loin (second écran, plein écran). */
.live-big { font-size: 40px; line-height: 44px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.live-now [data-live-status] { margin-top: 8px; }
.live-day { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.live-day .kpi:first-child { grid-column: 1 / -1; }
.live-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; }
.live-facts dd { margin: 0; font-size: 20px; line-height: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.live-facts dt { font-size: 12px; line-height: 16px; color: var(--text-2); }
.live-list { margin: 0; padding: 0; list-style: none; }
.live-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 32px; border-top: 1px solid var(--border); }
.live-list li:first-child { border-top: 0; }
.live-list li > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-list b { font-weight: 600; font-variant-numeric: tabular-nums; }
.live-page { display: block; max-width: 34ch; }
.panel-head h2.title-keep, .card-head h2.title-keep { flex: 1 0 auto; }   /* le titre reste entier : la précision passe dessous quand la place manque */
.live-link { padding: 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.live-link:hover { color: var(--accent); text-decoration: underline; }
.live:fullscreen { padding: 24px; grid-template-columns: minmax(0, 2.2fr) minmax(320px, 1fr); overflow: auto; }
.live:fullscreen .live-scene { top: 0; max-height: calc(100vh - 48px); }
@media (max-width: 1100px) {
  .live, .live:fullscreen { grid-template-columns: minmax(0, 1fr); }
  .live-scene { position: relative; top: 0; aspect-ratio: auto; height: 360px; }
  .live-scene canvas { touch-action: pan-y; }   /* au doigt : la page défile de haut en bas, le globe tourne de gauche à droite */
}
@media (max-width: 900px) {
  .live-page { max-width: 16ch; }
  .tbl .sub.hide-sm { display: none; }
}

/* ---------- Clarity : une ligne par boutique (Réglages), commande à copier (Visiteurs › Sessions) ---------- */
.cl-rows { display: grid; }
.cl-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr) minmax(0, 1.5fr) minmax(184px, auto); gap: 12px; align-items: start; padding: 12px 16px; border-top: 1px solid var(--border); margin: 0; }
.cl-row .sub { margin-top: 4px; }
.cl-row:first-child { border-top: 0; }
.cl-head { padding: 8px 16px; background: var(--surface-2); font-size: 12px; line-height: 16px; font-weight: 600; color: var(--text-3); }
.cl-row .sub { display: block; font-size: 12px; line-height: 16px; color: var(--text-3); }
.cl-row label { display: none; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.cl-row .row { justify-content: flex-end; flex-wrap: nowrap; min-height: 32px; }
.cmd { display: flex; gap: 8px; align-items: center; padding: 8px 8px 8px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.cmd code { flex: 1; min-width: 0; padding: 0; background: none; overflow-x: auto; white-space: nowrap; scrollbar-width: thin; }
.steps { margin: 0; padding-left: 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; color: var(--text-2); }
.steps li { min-width: 0; }
@media (max-width: 900px) {
  .cl-row { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 12px 16px; }
  .cl-head { display: none; }
  .cl-row label { display: block; }
  .cl-row .row { justify-content: flex-start; flex-wrap: wrap; }
}
