/* User Journey : feuille de style de l'application, reprise des maquettes (maquettes/assets/style.css). */
:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #e5e8ee;
  --border-strong: #d5dae2;
  --text: #18212d;
  --muted: #6b7482;
  --faint: #98a0ad;
  --primary: #14432a;
  --primary-hover: #0e3420;
  --primary-soft: #e7f2ec;
  --blue: #3b6fe0;      --blue-soft: #e9f0fd;
  --purple: #7b55d6;    --purple-soft: #f1ecfc;
  --teal: #1b9aa6;      --teal-soft: #e5f6f7;
  --orange: #e08a1e;    --orange-soft: #fdf3e5;
  --green: #1f9d57;     --green-soft: #e6f6ed;
  --pink: #df4f72;      --pink-soft: #fdecf0;
  --red: #d64545;       --red-soft: #fdecec;
  --grey-soft: #eef0f4;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; }
.tnum { font-variant-numeric: tabular-nums; }

/* En-tête */
.top {
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.top-inner {
  max-width: 1440px; margin: 0 auto; padding: 14px 28px;
  display: flex; align-items: center; gap: 24px;
}
.logo { display: flex; align-items: center; gap: 8px; color: var(--primary); font-weight: 500; line-height: 1; text-decoration: none !important; }
.logo-mark { width: 30px; height: 30px; border: 2px solid var(--primary); border-radius: 7px; display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.logo-text { font-size: 17px; letter-spacing: -.2px; }
.top-title { flex: 1; min-width: 0; }
.top-title h1 { font-size: 18px; }
.top-title .sub { color: var(--muted); margin-top: 2px; }
.client { text-align: right; }
.client-name { font-weight: 700; font-size: 16px; }
.client-user { color: var(--muted); font-size: 13px; }
.client-user a { color: var(--muted); }

.nav { background: var(--card); border-bottom: 1px solid var(--border); }
.nav-inner { max-width: 1440px; margin: 0 auto; padding: 0 22px; display: flex; gap: 2px; overflow-x: auto; }
.nav a {
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 12px 12px 11px; color: var(--muted); font-weight: 500;
  border-bottom: 2px solid transparent; text-decoration: none;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--primary); border-bottom-color: var(--primary); }
.nav .spacer { flex: 1; }
.nav .notes-toggle { color: var(--faint); font-size: 13px; }

.page { max-width: 1440px; margin: 0 auto; padding: 22px 28px 48px; }

/* Cartes */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); position: relative;
}
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 18px; }
.card-head {
  display: flex; align-items: center; gap: 12px; padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 15px; flex: 1; }
.card-head .hint { color: var(--muted); font-size: 13px; font-weight: 400; }
.card-body { padding: 18px 22px; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
@media (max-width: 1100px) { .cols-5, .cols-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .cols-2, .cols-3, .cols-4, .cols-5, .cols-6 { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } .top-inner, .page { padding-left: 16px; padding-right: 16px; } }

/* KPI */
.kpi { padding: 16px 18px; }
.kpi-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.kpi-label { font-size: 11.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 27px; font-weight: 700; margin-top: 10px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.kpi-sub { color: var(--muted); margin-top: 2px; font-size: 13px; }
.kpi-value.good { color: var(--green); }
.kpi-value.warn { color: #a87f00; }
.kpi-value.bad { color: var(--red); }
.icon {
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex: none; font-size: 15px;
}
.i-blue { background: var(--blue-soft); color: var(--blue); }
.i-purple { background: var(--purple-soft); color: var(--purple); }
.i-teal { background: var(--teal-soft); color: var(--teal); }
.i-orange { background: var(--orange-soft); color: var(--orange); }
.i-green { background: var(--green-soft); color: var(--green); }
.i-pink { background: var(--pink-soft); color: var(--pink); }
.i-red { background: var(--red-soft); color: var(--red); }

/* Filtres et formulaires */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 18px; }
.field {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 0 10px; height: 38px; background: #fff;
}
.field label { color: var(--muted); }
.field select, .field input { border: 0; outline: 0; font: inherit; color: var(--text); background: transparent; height: 36px; }
.field input[type=search] { width: 260px; }
.live { margin-left: auto; color: var(--green); display: flex; align-items: center; gap: 8px; font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: #fff; color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none !important; white-space: nowrap;
}
.btn:hover { background: #f7f8fa; }
.btn-danger { color: var(--red); border-color: #efc2c2; }
/* Session d'impersonation (se connecter en tant que) */
.imp-banner { position: sticky; top: 0; z-index: 70; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 16px; background: #3a1f5c; color: #fff; font-size: 13px; }
.imp-banner a { margin-left: auto; color: #fff; font-weight: 600; text-decoration: underline; }
.imp-panel { border: 1px solid #d9c9ef; background: #faf7fe; border-radius: 12px; padding: 14px 16px; margin: 0 18px 14px; }
.imp-panel[hidden] { display: none; }
.imp-panel h3 { margin: 0 0 6px; font-size: 14px; }
.imp-panel ul { margin: 6px 0 12px; padding-left: 18px; color: var(--muted); font-size: 13px; display: grid; gap: 3px; }
.btn-danger:hover { background: var(--red-soft); }
/* Décision sur une vente (fiche vente) */
.decision .card-head { flex-wrap: wrap; }
.dec-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.dec-actions[hidden] { display: none; }
.dec-lead { margin: 0 0 10px; font-weight: 500; }
.dec-effects { margin: 0 0 14px; padding-left: 18px; display: grid; gap: 5px; color: var(--muted); font-size: 13px; }
.dec-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.dec-panel[hidden] { display: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 7px 14px; font: inherit; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--primary); color: #fff; }

.form-grid { display: grid; gap: 14px 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row label { display: block; font-weight: 500; margin-bottom: 6px; }
.input { width: 100%; height: 38px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 10px; font: inherit; background: #fff; }
.help { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

.checks { display: grid; gap: 9px; }
.check { display: flex; align-items: center; gap: 10px; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.check .opt { color: var(--faint); }
.box { border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; }
.box-title { font-size: 11.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--primary); font-weight: 700; margin-bottom: 12px; }

/* Tableaux */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  font-weight: 600; padding: 12px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 13px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: #fafbfc; }
tr.total td { font-weight: 700; background: #fafbfc; border-bottom: 0; }
tr.subtotal td { font-weight: 600; background: #fafbfc; }
tr.unknown td { color: var(--muted); background: repeating-linear-gradient(135deg, #fff 0 8px, #fafbfc 8px 16px); }
tr.unknown td.num.strong { color: var(--text); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.b-green { background: var(--green-soft); color: var(--green); }
.b-orange { background: var(--orange-soft); color: #b86a0c; }
.b-blue { background: var(--blue-soft); color: var(--blue); }
.b-purple { background: var(--purple-soft); color: var(--purple); }
.b-red { background: var(--red-soft); color: var(--red); }
.b-grey { background: var(--grey-soft); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* Barres de progression */
.progress { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.bar { flex: 1; height: 6px; background: var(--grey-soft); border-radius: 99px; overflow: hidden; position: relative; }
.bar span { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.bar span.warn { background: var(--orange); }
.bar span.good { background: var(--green); }
.bar span.bad { background: var(--red); }
.bar .mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: .35; }
.progress .pct { width: 52px; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }

/* Entonnoir */
.funnel { display: grid; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 210px 1fr 90px 64px; align-items: center; gap: 14px; }
.funnel-row .lbl { font-weight: 500; }
.funnel-row .lbl small { display: block; color: var(--muted); font-weight: 400; }
.funnel-row .track { height: 22px; background: var(--grey-soft); border-radius: 6px; overflow: hidden; }
.funnel-row .fill { height: 100%; border-radius: 6px; }
.funnel-row .n { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.funnel-row .p { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.funnel-sep { border-top: 1px dashed var(--border-strong); margin: 4px 0; }
@media (max-width: 760px) { .funnel-row { grid-template-columns: 1fr 70px 50px; } .funnel-row .track { grid-column: 1 / -1; order: 4; } }

/* Listes de définitions */
.dl { display: grid; grid-template-columns: 220px 1fr; gap: 0; }
.dl > div { padding: 10px 0; border-bottom: 1px solid var(--border); }
.dl > div:nth-last-child(-n+2) { border-bottom: 0; }
.dl .k { color: var(--muted); }
@media (max-width: 760px) { .dl { grid-template-columns: 1fr; } .dl .k { border-bottom: 0; padding-bottom: 0; } }

.quote {
  background: #fafbfc; border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 8px;
  padding: 12px 14px; font-size: 13px; color: #374151;
}
pre.code {
  margin: 0; background: #0f1720; color: #d6e2ef; border-radius: 8px; padding: 12px 14px; overflow-x: auto;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; }
.alert + .alert { margin-top: 10px; }
.alert .icon { width: 30px; height: 30px; font-size: 13px; }
.alert-title { font-weight: 600; }
.alert-text { color: var(--muted); font-size: 13px; }
.a-orange { background: var(--orange-soft); }
.a-red { background: var(--red-soft); }
.a-blue { background: var(--blue-soft); }
.a-green { background: var(--green-soft); }

.banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 10px;
  background: var(--blue-soft); color: #234a9c; margin-bottom: 18px;
}

.pager { display: flex; gap: 6px; margin-left: auto; }
.pager a, .pager span { min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: 7px; display: grid; place-items: center; color: var(--text); text-decoration: none; }
.pager .on { background: var(--primary); border-color: var(--primary); color: #fff; }

.legend { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: 13px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

.chart { height: 340px; }
.chart-sm { height: 240px; }

.empty { color: var(--faint); font-style: italic; }
.masked { color: var(--faint); letter-spacing: 1px; }

/* Annotations de maquette : statut de chaque bloc par rapport à la plateforme */
.note {
  position: absolute; top: -9px; right: 14px; z-index: 2;
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; cursor: help;
  border: 1px solid; background: #fff; white-space: nowrap;
}
.note.ok { color: var(--green); border-color: #a9dcbf; }
.note.calc { color: #b86a0c; border-color: #f0cf9f; }
.note.new { color: var(--red); border-color: #f1b3b3; }
.note-inline { position: static; display: inline-block; margin-left: 6px; vertical-align: 1px; }
body.notes-off .note { display: none; }
.note-pop {
  position: fixed; z-index: 50; max-width: 340px; background: #18212d; color: #fff; font-size: 12.5px; line-height: 1.45;
  padding: 10px 12px; border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.18); pointer-events: none;
}
.notes-legend { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 16px; }
.notes-legend .note { position: static; }
body.notes-off .notes-legend { display: none; }

/* Fausse capture d'écran du formulaire */
.shot { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.shot-bar { background: #eef0f4; padding: 7px 10px; display: flex; gap: 6px; align-items: center; }
.shot-bar i { width: 9px; height: 9px; border-radius: 50%; background: #cfd4dc; display: inline-block; }
.shot-bar span { margin-left: 8px; font-size: 11px; color: var(--muted); background: #fff; border-radius: 5px; padding: 2px 8px; flex: 1; }
.shot-body { padding: 18px; background: linear-gradient(180deg, #fdf6e7, #fff); }
.shot-title { font-weight: 700; font-size: 15px; margin-bottom: 10px; }
.shot-input { height: 24px; border: 1px solid #d9dde3; border-radius: 5px; background: #fff; margin-bottom: 7px; font-size: 11px; color: #4b5563; padding: 4px 8px; }
.shot-opt { display: flex; gap: 8px; font-size: 10.5px; color: #4b5563; margin: 10px 0; }
.shot-opt b { width: 12px; height: 12px; border: 1px solid #9aa3af; border-radius: 3px; flex: none; background: var(--primary); }
.shot-btn { background: #e0612f; color: #fff; border-radius: 6px; text-align: center; padding: 7px; font-weight: 700; font-size: 12px; }

/* Tableaux denses (liste des campagnes) */
.table-compact th, .table-compact td { padding-left: 10px; padding-right: 10px; }
.table-compact .col-name { min-width: 230px; }
.table-compact .progress { min-width: 150px; }

/* Listes déroulantes stylées (choix multiple ou unique) */
.ms { position: relative; display: inline-block; }
.ms-btn { cursor: pointer; font: inherit; color: var(--text); max-width: 340px; }
.ms-btn:hover { border-color: #b9c0cb; }
.ms-btn label { cursor: pointer; }
.ms-value { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.ms-caret { font-size: 11px; color: var(--faint); transition: transform .15s; }
.ms.open .ms-caret { transform: rotate(180deg); }
.ms.open .ms-btn { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.ms-btn.ms-active { background: var(--primary-soft); border-color: #b5d6c3; }
.ms-btn.ms-active .ms-value { color: var(--primary); }
.ms-panel {
  display: none; position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: max-content; min-width: 240px; max-width: 400px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, .14);
  overflow: hidden;
}
.ms.open .ms-panel { display: block; }
.ms-search { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--faint); }
.ms-search input { border: 0; outline: 0; font: inherit; flex: 1; min-width: 0; color: var(--text); }
.ms-list { max-height: 290px; overflow-y: auto; padding: 6px; }
.ms-group { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); font-weight: 600; padding: 8px 8px 4px; }
.ms-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 7px; cursor: pointer; }
.ms-item:hover { background: #f4f6f9; }
.ms-item input { width: 16px; height: 16px; accent-color: var(--primary); flex: none; margin: 0; }
.ms-item:has(input:checked) { background: var(--primary-soft); color: var(--primary); font-weight: 500; }
.ms-foot { display: flex; justify-content: space-between; border-top: 1px solid var(--border); padding: 8px 12px; }
.ms-foot button { border: 0; background: none; font: inherit; color: var(--blue); cursor: pointer; padding: 4px 0; }
.ms-foot .ms-none { color: var(--muted); }

/* Mobile */
@media (max-width: 760px) {
  body { font-size: 13.5px; }
  .top-inner { flex-wrap: wrap; gap: 8px 16px; padding-top: 12px; padding-bottom: 12px; }
  .top-title { order: 3; flex-basis: 100%; }
  .top-title h1 { font-size: 16px; }
  .client { margin-left: auto; }
  .client-name { font-size: 14px; }
  .nav-inner { padding: 0 8px; }
  .nav a { padding: 11px 9px 10px; }
  .nav .spacer, .nav .notes-toggle span { display: none; }
  .notes-legend { font-size: 12px; gap: 8px; }
  .filters { padding: 12px; gap: 8px; }
  .filters > .field, .filters > .ms, .filters > .seg { width: 100%; }
  .filters .ms-btn { width: 100%; max-width: none; }
  .filters .ms-value { max-width: none; flex: 1; text-align: left; }
  .ms-panel { left: 0; right: 0; max-width: none; }
  .field input[type=search] { width: 100%; }
  .field select, .field input { flex: 1; min-width: 0; }
  .seg { display: flex; overflow-x: auto; }
  .seg button { flex: 1; white-space: nowrap; }
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi-value { font-size: 21px; }
  .kpi .icon { width: 30px; height: 30px; font-size: 13px; }
  .card-head { flex-wrap: wrap; padding: 14px 16px; }
  .card-body { padding: 14px 16px; }
  .card-foot { padding: 12px 16px; }
  .chart { height: 260px; }
  .live { margin-left: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .banner { align-items: flex-start; }
}

/* Filtres sur une seule ligne (écran large) */
@media (min-width: 761px) {
  .filters.one-line { flex-wrap: nowrap; }
  .filters.one-line .grow { flex: 1; min-width: 160px; }
  .filters.one-line .grow input { width: 100%; }
}

/* Tableaux triables */
.sortable th[data-sort] { cursor: pointer; user-select: none; }
.sortable th[data-sort]:hover { color: var(--text); }
.sortable th i { color: var(--primary); }

/* Pas de marge entre cartes d'une même grille */
.grid > .card + .card { margin-top: 0; }

/* Mobile : tableaux en fiches (table.stack) ; tableau statistique avec première colonne figée */
@media (max-width: 760px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  table.stack tbody tr:hover { background: transparent; }
  table.stack td { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 4px 0; border: 0; text-align: right; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; max-width: 45%; }
  table.stack td:first-child { display: block; text-align: left; padding-bottom: 6px; font-weight: 600; }
  table.stack td:first-child::before { content: none; }
  table.stack td:empty, table.stack td[data-label=""] { display: none; }
  table.stack td.num, table.stack td.center { text-align: right; }
  table.stack td[colspan] { display: block; text-align: left; }
  table.stack td[colspan]::before { content: none; }
  table.stack .progress { min-width: 0; flex: 1; max-width: 62%; }
  table.stack .chips { justify-content: flex-end; }
  table.stack tr.total { background: #fafbfc; }
  table.stack tr.total td:empty { display: none; }
  .funnel-row .p { white-space: nowrap; }
  .funnel-row { grid-template-columns: 1fr 74px 56px; }
  table.sortable td:first-child, table.sortable th:first-child { position: sticky; left: 0; background: #fff; z-index: 1; box-shadow: 1px 0 0 var(--border); }
  table.sortable tr.total td:first-child { background: #fafbfc; }
  .dl > div { padding: 8px 0; }
}
@media (max-width: 760px) {
  table.stack .stack-v { display: block; }
  table.stack td:first-child .stack-v { text-align: left; }
  table.stack .stack-v .progress { max-width: none; }
}

/* Une cellule de grille ne s'élargit pas avec son contenu (code, tableaux) */
.grid > * { min-width: 0; }

.logo img { display: block; height: 40px; width: auto; }
@media (max-width: 760px) { .logo img { height: 32px; } }

/* ===================== Ajouts User Journey ===================== */
:root { --primary: #1d3f8f; --primary-hover: #163273; --primary-soft: #e8eefb; }

/* Logo texte */
.logo-mark { color: var(--primary); }
.logo-text b { font-weight: 700; }

/* Menu groupé : un lien direct ou un groupe avec sous-menu */
.nav-inner { overflow: visible; flex-wrap: wrap; }
.nav-group { position: relative; }
.nav-group > button {
  display: flex; align-items: center; gap: 8px; white-space: nowrap; background: none; border: 0; cursor: pointer;
  padding: 12px 12px 11px; color: var(--muted); font: inherit; font-weight: 500; border-bottom: 2px solid transparent;
}
.nav-group > button:hover, .nav-group.open > button { color: var(--text); }
.nav-group.active > button { color: var(--primary); border-bottom-color: var(--primary); }
.nav-group > button .fa-chevron-down { font-size: 10px; color: var(--faint); }
.nav-menu {
  display: none; position: absolute; z-index: 40; top: 100%; left: 0; min-width: 260px; padding: 6px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, .14);
}
.nav-group.open .nav-menu { display: block; }
.nav .nav-menu a { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 7px; border: 0; color: var(--text); white-space: normal; }
.nav .nav-menu a:hover { background: #f4f6f9; text-decoration: none; }
.nav .nav-menu a.active { background: var(--primary-soft); color: var(--primary); }
.nav-menu a i { width: 16px; margin-top: 3px; color: var(--muted); }
.nav-menu a small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
@media (max-width: 760px) {
  .nav-menu { position: fixed; left: 8px; right: 8px; top: auto; }
}

/* Étiquettes de lot (MVP / V1 / V2) */
.note.mvp { color: var(--primary); border-color: #b8c8ee; }
.note.v1 { color: #b86a0c; border-color: #f0cf9f; }
.note.v2 { color: var(--purple); border-color: #d3c4f3; }
.note.v3 { color: #4d6a78; border-color: #c5d3da; }

/* Fil d'Ariane */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.crumbs i { font-size: 10px; color: var(--faint); }

/* Badges de levier (couleur par levier) */
.lv { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; white-space: nowrap; }
.lv::before { content: ''; width: 9px; height: 9px; border-radius: 3px; background: var(--lv, #98a0ad); flex: none; }

/* Arborescence dans un tableau (levier > plateforme > éditeur > sous-éditeur) */
.tree-name { display: flex; align-items: center; gap: 8px; }
.tree-toggle { width: 20px; height: 20px; border: 0; background: none; border-radius: 5px; color: var(--muted); cursor: pointer; display: grid; place-items: center; flex: none; }
.tree-toggle:hover { background: var(--grey-soft); }
.tree-toggle.leaf { visibility: hidden; }
tr[data-depth="1"] .tree-name { padding-left: 22px; }
tr[data-depth="2"] .tree-name { padding-left: 44px; }
tr[data-depth="3"] .tree-name { padding-left: 66px; }
tr[data-depth="0"] td { font-weight: 600; }
tr.is-hidden { display: none; }

/* Frise d'un parcours (points de contact) */
.journey { position: relative; display: grid; gap: 0; }
.journey-step { display: grid; grid-template-columns: 120px 28px 1fr auto; gap: 14px; align-items: flex-start; padding: 12px 0; }
.journey-step .when { color: var(--muted); font-size: 12.5px; text-align: right; padding-top: 3px; font-variant-numeric: tabular-nums; }
.journey-step .when b { display: block; color: var(--text); font-size: 13px; }
.journey-step .pin { position: relative; height: 100%; display: flex; justify-content: center; }
.journey-step .pin::before { content: ''; position: absolute; top: 0; bottom: -12px; width: 2px; background: var(--border-strong); }
.journey-step:first-child .pin::before { top: 12px; }
.journey-step:last-child .pin::before { display: none; }
.journey-step .pin span { position: relative; z-index: 1; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; color: #fff; background: var(--lv, var(--muted)); box-shadow: 0 0 0 4px #fff; }
.journey-step .what .t { font-weight: 600; }
.journey-step .what .d { color: var(--muted); font-size: 13px; }
.journey-step .share { text-align: right; min-width: 120px; }
.journey-step .share .v { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.journey-step.conv .pin span { background: var(--green); }
.journey-gap { margin-left: 148px; padding: 2px 0 2px 26px; color: var(--faint); font-size: 12px; }
@media (max-width: 760px) {
  .journey-step { grid-template-columns: 26px 1fr; }
  .journey-step .when { grid-column: 2; text-align: left; order: -1; padding: 0; }
  .journey-step .pin { grid-row: 1 / span 3; }
  .journey-step .share { grid-column: 2; text-align: left; }
  .journey-gap { margin-left: 40px; }
}

/* Paramètres d'URL */
.param { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; margin: 2px 4px 2px 0; }
.param .k { background: var(--grey-soft); color: var(--muted); padding: 0 6px; }
.param .v { padding: 0 6px; }
.param.missing { border-color: #f1b3b3; }
.param.missing .v { color: var(--red); }

/* Matrice de permissions */
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix .grp td { background: #fafbfc; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; text-align: left; }
.matrix .yes { color: var(--green); }
.matrix .no { color: var(--faint); }
.matrix .part { color: var(--orange); }

/* Interrupteur */
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfd4dc; border-radius: 99px; transition: .15s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(16px); }

/* Écart (variation signée) */
.delta-up { color: var(--green); font-weight: 600; }
.delta-down { color: var(--red); font-weight: 600; }
.delta-flat { color: var(--muted); }

/* Panneau latéral de détail */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }

/* Onglets */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 22px; overflow-x: auto; }
.tabs a { padding: 12px 10px 11px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a.on { color: var(--primary); border-bottom-color: var(--primary); }

/* Fiabilité */
.reliab { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.reliab b { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.reliab.prob b { background: var(--orange); }

/* ===================== Écrans d'accès (connexion, code, TOTP, mot de passe) ===================== */
.mq-bar { position: sticky; top: 0; z-index: 20; background: #fffbeb; border-bottom: 1px dashed #f59e0b; padding: 8px 16px; font-size: 12.5px; color: #78350f; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.mq-bar a { color: #92400e; text-decoration: none; padding: 1px 6px; border-radius: 5px; white-space: nowrap; }
.mq-bar a.active { background: #f59e0b; color: #fff; }
.mq-group { display: inline-flex; flex-wrap: wrap; gap: 2px; align-items: center; }
.mq-label { font-weight: 600; margin-right: 4px; }
.mq-note { max-width: 420px; margin: 0 auto; background: #fffbeb; border: 1px dashed #f59e0b; border-radius: 10px; padding: 10px 13px; font-size: 12.5px; color: #78350f; }
body.notes-off .mq-note { display: none; }

.auth { min-height: calc(100vh - 140px); display: flex; align-items: center; justify-content: center; padding: 40px 16px 20px; }
.auth-column { width: 100%; max-width: 420px; }
.auth-logo { display: flex; justify-content: center; margin-bottom: 28px; }
.auth-logo .logo-mark { width: 40px; height: 40px; font-size: 18px; border-radius: 9px; }
.auth-logo .logo-text { font-size: 24px; }
.auth-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 30px 30px 26px; box-shadow: var(--shadow); }
.auth-card h2 { font-size: 21px; font-weight: 700; margin: 0 0 6px; }
.auth-lead { color: var(--muted); margin-bottom: 22px; }
.auth-card .form-row { margin-bottom: 14px; }
.auth-card .input { height: 42px; }
.auth-card .input:focus, .otp-boxes input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.auth-card .btn { height: 42px; width: 100%; justify-content: center; }
.auth-card .btn + .btn { margin-top: 8px; }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 13px; }
.input-icon .input { padding-left: 34px; }
.input-icon .eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); width: 32px; height: 32px; border-radius: 6px; cursor: pointer; }
.auth-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; margin: 2px 0 18px; }
.auth-sep { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12.5px; margin: 18px 0; }
.auth-sep::before, .auth-sep::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.auth-foot { margin-top: 22px; text-align: center; font-size: 13px; color: var(--muted); }
.auth-back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.auth-legal { text-align: center; font-size: 12px; color: var(--faint); margin-top: 20px; }
.auth-legal a { color: var(--muted); }
.auth-alert { display: flex; gap: 10px; align-items: flex-start; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 18px; border: 1px solid; }
.auth-alert i { margin-top: 2px; }
.auth-alert.danger { background: var(--red-soft); border-color: #f5c2c2; color: #7f1d1d; }
.auth-alert.warning { background: var(--orange-soft); border-color: #f0cf9f; color: #78350f; }
.auth-alert.info { background: var(--blue-soft); border-color: #c4d4f6; color: #1e3a8a; }
.auth-alert.success { background: var(--green-soft); border-color: #b9e2c9; color: #14532d; }
.auth-hero { width: 52px; height: 52px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: inline-grid; place-items: center; font-size: 20px; margin-bottom: 16px; }
.otp-boxes { display: flex; gap: 8px; justify-content: space-between; margin-bottom: 16px; }
.otp-boxes input { width: 100%; max-width: 54px; height: 54px; text-align: center; font: 600 22px Inter, sans-serif; border: 1px solid var(--border-strong); border-radius: 8px; }
.otp-boxes .sep { align-self: center; color: var(--faint); }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 13px; margin-top: 16px; }
.auth-channel { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; border: 1px solid var(--border); border-radius: 10px; padding: 13px 15px; background: #fff; margin-bottom: 10px; color: inherit; font: inherit; cursor: pointer; }
.auth-channel:hover { border-color: var(--primary); background: #f7f9fe; }
.auth-channel .ico { width: 38px; height: 38px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: none; }
.auth-channel strong { display: block; }
.auth-channel small { color: var(--muted); }
.auth-channel .fa-chevron-right { margin-left: auto; color: var(--faint); font-size: 12px; }
.auth-channel .rec { margin-left: auto; }
.auth-rules { list-style: none; padding: 0; margin: -6px 0 18px; font-size: 12.5px; color: var(--muted); display: grid; gap: 3px; }
.auth-rules li.ok { color: var(--green); }
.auth-rules i { width: 16px; }
.steps { display: flex; gap: 6px; margin-bottom: 20px; }
.steps span { flex: 1; height: 4px; border-radius: 99px; background: var(--grey-soft); }
.steps span.on { background: var(--primary); }
.qr { width: 168px; height: 168px; margin: 4px auto 14px; border: 1px solid var(--border); border-radius: 10px; padding: 10px; display: grid; grid-template-columns: repeat(21, 1fr); gap: 0; background: #fff; }
.qr i { display: block; aspect-ratio: 1; }
.qr i.b { background: #18212d; }
.secret { text-align: center; font: 600 14px ui-monospace, Menlo, Consolas, monospace; letter-spacing: 2px; background: var(--grey-soft); border-radius: 8px; padding: 9px; margin-bottom: 18px; }
.backup-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.backup-codes code { background: var(--grey-soft); border-radius: 6px; padding: 7px; text-align: center; font: 600 13px ui-monospace, Menlo, Consolas, monospace; letter-spacing: 1px; }
.split + .grid, .split + .card, .grid + .split, .card + .split, .split + .split { margin-top: 18px; }
.split > div > .card + .card { margin-top: 18px; }

/* Événements d'un visiteur, groupés par visite */
.visit { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.visit + .visit { margin-top: 12px; }
.visit-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 11px 14px; background: #fafbfc; border-bottom: 1px solid var(--border); }
.visit-head .t { font-weight: 600; }
.visit-head .src { margin-left: auto; }
.ev { display: grid; grid-template-columns: 74px 150px 1fr; gap: 12px; padding: 8px 14px; border-top: 1px solid var(--border); align-items: baseline; font-size: 13px; }
.ev:first-of-type { border-top: 0; }
.ev .ts { color: var(--muted); font-variant-numeric: tabular-nums; }
.ev .ty { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.ev.key { background: #f7f9fe; }
@media (max-width: 760px) { .ev { grid-template-columns: 60px 1fr; } .ev .d { grid-column: 1 / -1; } }
.idg { display: grid; gap: 10px; }
.idg-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; }
.split > .card + .card { margin-top: 0; }
.alert + .card, .card + .alert, .grid + .alert, .alert + .grid { margin-top: 18px; }
/* Étapes d'un circuit de publication */
.flow { display: flex; gap: 0; align-items: stretch; flex-wrap: wrap; }
.flow-step { flex: 1; min-width: 140px; padding: 12px 14px; border: 1px solid var(--border); border-left: 0; position: relative; background: #fff; }
.flow-step:first-child { border-left: 1px solid var(--border); border-radius: 10px 0 0 10px; }
.flow-step:last-child { border-radius: 0 10px 10px 0; }
.flow-step .n { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.flow-step .t { font-weight: 600; margin-top: 2px; }
.flow-step .d { color: var(--muted); font-size: 12.5px; }
.flow-step.done { background: var(--green-soft); }
.flow-step.done .n { color: var(--green); }
.flow-step.cur { background: var(--primary-soft); box-shadow: inset 0 -3px 0 var(--primary); }
.flow-step.cur .n { color: var(--primary); }
.diff-del { background: var(--red-soft); color: #8f2a2a; text-decoration: line-through; padding: 0 4px; border-radius: 4px; }
.diff-add { background: var(--green-soft); color: #14532d; padding: 0 4px; border-radius: 4px; }

.split > :last-child .dl { grid-template-columns: 140px 1fr; }
.split > :last-child .dl > div:nth-child(odd) { padding-right: 12px; }
.split > * { min-width: 0; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }
.param { max-width: 100%; }
.param .v { overflow-wrap: anywhere; }
@media (max-width: 760px) { .card-head .seg { max-width: 100%; } .journey-step .what { min-width: 0; } }

/* ===================== Lot 2 : portail partenaire, litiges, exports ===================== */
.space-tag { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: #fff; background: var(--teal); border-radius: 5px; padding: 2px 6px; vertical-align: 2px; }
body.space-partner .top { border-top: 3px solid var(--teal); }
body.space-partner .client { display: flex; flex-direction: column; align-items: flex-end; }
body.space-partner .client .ms-btn { height: 32px; }
@media (max-width: 760px) { body.space-partner .client { align-items: flex-start; } .space-tag { display: none; } }

/* Fil d'échanges (litiges, réclamations) */
.thread { display: grid; gap: 14px; }
.msg { display: grid; grid-template-columns: 34px 1fr; gap: 10px; }
.msg .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; background: var(--primary-soft); color: var(--primary); }
.msg.partner .av { background: var(--teal-soft); color: var(--teal); }
.msg.system .av { background: var(--grey-soft); color: var(--muted); }
.msg .bubble { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fff; }
.msg.system .bubble { background: #fafbfc; }
.msg .meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.msg .meta b { color: var(--text); }
.file-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 7px; padding: 4px 8px; font-size: 12.5px; margin: 6px 6px 0 0; color: var(--text); background: #fafbfc; }

/* Étapes verticales (assistant d'installation) */
.wizard { display: grid; gap: 0; }
.wz { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.wz:last-child { border-bottom: 0; }
.wz .num { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; border: 2px solid var(--border-strong); color: var(--muted); background: #fff; }
.wz.done .num { background: var(--green); border-color: var(--green); color: #fff; }
.wz.cur .num { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.wz .t { font-weight: 600; font-size: 15px; }
.wz .d { color: var(--muted); margin: 2px 0 10px; }
.checklist { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.checklist li { display: flex; gap: 8px; align-items: center; }
.checklist .fa-circle-check { color: var(--green); }
.checklist .fa-spinner { color: var(--primary); }
.checklist .fa-circle { color: var(--faint); }

/* Jauge de consommation */
.gauge { height: 14px; background: var(--grey-soft); border-radius: 99px; overflow: hidden; position: relative; }
.gauge span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.gauge i { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--orange); }

/* ===================== Lot 3 : espace éditeur, back-office opérateur ===================== */
body.space-publisher .top { border-top: 3px solid var(--purple); }
body.space-publisher .space-tag { background: var(--purple); }
body.space-operator { --bg: #f1f3f6; }
body.space-operator .top { background: #18212d; border-bottom-color: #18212d; }
body.space-operator .top .logo, body.space-operator .top h1, body.space-operator .client-name { color: #fff; }
body.space-operator .top .logo-mark { color: #fff; border-color: #fff; }
body.space-operator .top .sub, body.space-operator .client-user, body.space-operator .client-user a { color: #aab3c0; }
body.space-operator .space-tag { background: var(--orange); }
.lock-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); background: var(--grey-soft); border-radius: 6px; padding: 2px 8px; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.status-dot.ok { background: var(--green); } .status-dot.warn { background: var(--orange); } .status-dot.bad { background: var(--red); }

/* ===================== Segments de rémunération ===================== */
.comp { display: grid; grid-template-columns: 170px 110px minmax(0, 1fr) 34px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.comp:last-of-type { border-bottom: 0; }
.comp .input { height: 34px; }
.comp .btn { padding: 0 8px; height: 34px; }
@media (max-width: 760px) { .comp { grid-template-columns: 1fr 1fr; } }
.chip-c { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
/* Composantes de rémunération : gamme propre (bleu marine, bleu moyen, or, bleu clair, gris), distincte des leviers */
.chip-c.click { background: #f8f0d6; color: #8a6a00; }
.chip-c.pct { background: #e3e9f6; color: #1d3f8f; }
.chip-c.fixed { background: #e8eefb; color: #3d5fb0; }
.chip-c.lead { background: #eef2fa; color: #5a72a8; }
.chip-c.fee { background: var(--grey-soft); color: var(--muted); }
.exc { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-top: 10px; }
.exc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ===================== Validation des transactions ===================== */
.batchbar { position: sticky; top: 0; z-index: 15; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 22px; background: var(--primary); color: #fff; }
.batchbar .btn { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); color: #fff; }
.batchbar .btn:hover { background: rgba(255,255,255,.22); }
.batchbar .count { font-weight: 600; margin-right: 6px; }
.batchbar.off { background: var(--grey-soft); color: var(--muted); }
.batchbar.off .btn { background: #fff; color: var(--faint); border-color: var(--border); pointer-events: none; }
td.sel, th.sel { width: 34px; }
td.sel input, th.sel input { width: 16px; height: 16px; accent-color: var(--primary); }
.amount-old { color: var(--faint); text-decoration: line-through; font-size: 12px; display: block; }

/* Blocs de code avec bouton Copier, coloration minimale */
.code-wrap { position: relative; min-width: 0; }
.code-wrap + .code-wrap, .code-wrap + .help { margin-top: 10px; }
.code-wrap .copy { position: absolute; top: 8px; right: 8px; z-index: 1; display: inline-flex; gap: 6px; align-items: center; border: 1px solid #2c3a4b; background: #1a2533; color: #d6e2ef; border-radius: 6px; padding: 4px 9px; font: 500 12px Inter, system-ui, sans-serif; cursor: pointer; }
.code-wrap .copy:hover { background: #24344a; }
.code-wrap pre.code { padding-right: 90px; }
pre.code .c { color: #7f8ea3; }
pre.code .s { color: #a5d6a7; }
pre.code .k { color: #8fb4ff; }
pre.code .n { color: #f3c47a; }
.card > .tabs[data-tabs] { padding: 0 22px; }
.tabs[data-tabs] a { cursor: pointer; }
[data-pane][hidden] { display: none !important; }

/* Répartition des positions dans le parcours */
.bar.mixbar { height: 10px; display: flex; }
.bar.mixbar span { border-radius: 0; }

/* Contrôles de diagnostic */
.checkrow { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: start; padding: 11px 0; border-bottom: 1px solid var(--border); }
.checkrow:last-child { border-bottom: 0; }
.checkrow > i { margin-top: 3px; }
.checkrow .t { font-weight: 600; }
.checkrow .d { color: var(--muted); font-size: 13px; }
.checkrow .fa-circle-check { color: var(--green); }
.checkrow .fa-triangle-exclamation { color: var(--orange); }
.checkrow .fa-circle-xmark { color: var(--red); }
.check-group { font-size: 11.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--primary); font-weight: 700; margin: 16px 0 2px; }
.check-group:first-child { margin-top: 0; }
.score { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.score .ring { width: 86px; height: 86px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; font-weight: 700; background: conic-gradient(var(--green) 0 var(--p), var(--grey-soft) var(--p) 100%); position: relative; }
.score .ring::before { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: #fff; }
.score .ring span { position: relative; }
.timeline-ev { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.timeline-ev:last-child { border-bottom: 0; }
@media (max-width: 760px) { .checkrow { grid-template-columns: 22px 1fr; } .checkrow > :nth-child(3) { grid-column: 2; } }

/* Identifiants longs (domaines, URL) dans les listes de définitions et indicateurs */
.dl .mono, .kpi-value.break { word-break: break-all; }

/* Infobulle des barres de position */
.mixbar { cursor: default; }
.tip-pop { position: fixed; z-index: 60; min-width: 230px; background: #fff; color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; box-shadow: 0 8px 28px rgba(16,24,40,.16); pointer-events: none; font-size: 12.5px; }
[data-help] { cursor: help; }
.help-i { color: var(--faint); font-size: 11px; margin-left: 2px; }
.help-pop { position: fixed; z-index: 60; width: 320px; background: #fff; color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; box-shadow: 0 8px 28px rgba(16,24,40,.16); pointer-events: none; font-size: 12.5px; font-weight: 400; line-height: 1.5; text-transform: none; letter-spacing: 0; text-align: left; white-space: normal; }
.tip-pop .tip-title { font-weight: 600; margin-bottom: 6px; color: var(--muted); font-size: 11.5px; }
.tip-pop .tip-row { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: center; padding: 2px 0; }
.tip-pop .tip-row i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tip-pop .tip-row b { font-variant-numeric: tabular-nums; }

/* Positions dans le parcours : même gamme que les barres (prune), jamais une couleur de levier */
.faint { color: var(--faint); }
.badge.b-init { background: #6b2d5c; color: #fff; }
.badge.b-pass { background: #ecd3e3; color: #6b2d5c; }
.badge.b-concl { background: #f8eef4; color: #8a4a78; box-shadow: inset 0 0 0 1px #e3c2d8; }

/* Texte d'alerte générique (délais, écarts) */
.warn { color: #a87f00; }
.bad { color: var(--red); }
td .bad, td .warn { font-weight: 600; }
.legend.center { justify-content: center; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: inline-grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }

/* ------------------------------------------------------------------ Expérience : toasts, panneau latéral, micro-animations, illustrations */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.toast { position: relative; overflow: hidden; display: flex; align-items: flex-start; gap: 10px; background: #18212d; color: #fff; border-radius: 12px; padding: 12px 12px 14px 14px; box-shadow: 0 12px 32px rgba(16, 24, 40, .22); animation: toast-in .32s cubic-bezier(.2, .9, .3, 1.2) both; }
.toast.out { animation: toast-out .26s ease both; }
.toast > i { margin-top: 2px; font-size: 16px; }
.toast.t-ok > i { color: #5fd38d; } .toast.t-info > i { color: #8db2ff; } .toast.t-warn > i { color: #f5b45c; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 600; }
.toast-text { color: #b9c1cc; font-size: 12.5px; margin-top: 2px; overflow-wrap: anywhere; }
.toast-act { background: rgba(255, 255, 255, .12); color: #fff; border: 0; border-radius: 7px; padding: 5px 10px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.toast-act:hover { background: rgba(255, 255, 255, .2); }
.toast-x { background: none; border: 0; color: #8a94a3; cursor: pointer; padding: 2px 4px; }
.toast-timer { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: rgba(255, 255, 255, .25); transform-origin: left; animation: toast-timer linear both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px); } }
@keyframes toast-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.drawer-wrap { position: fixed; inset: 0; z-index: 250; }
.drawer-veil { position: absolute; inset: 0; background: rgba(16, 24, 40, .32); opacity: 0; transition: opacity .24s ease; }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); background: var(--card); box-shadow: -12px 0 40px rgba(16, 24, 40, .18); display: flex; flex-direction: column; transform: translateX(104%); transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.drawer-wrap.on .drawer-veil { opacity: 1; }
.drawer-wrap.on .drawer { transform: none; }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 17px; }
.drawer-head > div { flex: 1; min-width: 0; }
.drawer-x { background: none; border: 0; font-size: 18px; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.drawer-x:hover { background: var(--grey-soft); }
.drawer-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.drawer-body .form-row { margin-bottom: 14px; }
.drawer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.qr-box { display: grid; place-items: center; padding: 16px; background: var(--grey-soft); border-radius: 12px; margin-bottom: 12px; }
.shake { animation: shake .45s ease; border-color: var(--red) !important; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* Boutons : appui, attente, succès */
.btn { transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .12s ease; }
.btn:active:not([disabled]) { transform: scale(.97); }
.btn-primary:hover { box-shadow: 0 4px 12px rgba(20, 67, 42, .25); }
.btn.is-busy { pointer-events: none; opacity: .85; }
.btn.is-done { background: var(--green-soft); border-color: #bfe3cd; color: var(--green); animation: pop .35s ease; }
.btn.is-done[disabled] { opacity: 1; cursor: default; }
@keyframes pop { 40% { transform: scale(1.06); } }
.ux-pop { animation: pop .4s ease; }

/* Entrée des blocs, lignes nouvelles ou retirées */
.ux-rise { animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
tr.ux-flash > td { animation: flash 1.4s ease; }
@keyframes flash { 0%, 30% { background: #fff6d6; } }
tr.ux-out { opacity: 0; transform: translateX(16px); transition: opacity .3s ease, transform .3s ease; }
tr.ux-muted td { color: var(--faint); }
.ux-grow { animation: grow .9s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes grow { from { transform: scaleX(0); } }
.kpi { transition: box-shadow .2s ease, transform .2s ease; }
.kpi:hover { box-shadow: 0 6px 18px rgba(16, 24, 40, .08); transform: translateY(-1px); }
.kpi .icon { transition: transform .3s ease; }
.kpi:hover .icon { transform: rotate(-8deg) scale(1.08); }
table tbody tr { transition: background-color .15s ease; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 6px; position: relative; vertical-align: 1px; }
.live-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--green); animation: ping 1.8s ease-out infinite; }
@keyframes ping { to { transform: scale(2.6); opacity: 0; } }
.help-pop { animation: rise .16s ease both; }
.dec-panel:not([hidden]), .imp-panel:not([hidden]) { animation: rise .25s ease both; }

/* Illustrations */
.illus { display: block; max-width: 100%; height: auto; }
.illus .il-path { animation: dash 16s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -300; } }
.illus .il-dot, .illus .il-bag, .illus .il-pop { transform-box: fill-box; transform-origin: center; animation: pop-in .6s cubic-bezier(.2, 1.4, .4, 1) both; animation-delay: var(--d, .3s); }
@keyframes pop-in { from { transform: scale(0); opacity: 0; } }
.illus .il-float { animation: float 4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-5px); } }
.illus .il-flame { transform-box: fill-box; transform-origin: top center; animation: flame .5s ease-in-out infinite alternate; }
@keyframes flame { to { transform: scaleY(1.35); } }
.illus .il-spark { animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .3; } }
.empty { display: grid; justify-items: center; gap: 4px; padding: 26px 16px 30px; text-align: center; }
.empty .illus { width: 170px; margin-bottom: 6px; }
.empty-title { font-weight: 600; font-size: 15px; }
.confetti { position: fixed; z-index: 400; width: 8px; height: 12px; border-radius: 2px; pointer-events: none; animation: confetti 1.25s cubic-bezier(.2, .7, .4, 1) forwards; }
@keyframes confetti { to { transform: translate(var(--x), calc(var(--y) + 220px)) rotate(var(--r)); opacity: 0; } }

/* Bandeau « En bref » de la vue d'ensemble */
.hero { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 22px; align-items: center; padding: 20px 22px; margin-bottom: 18px; background: linear-gradient(120deg, #ffffff 0%, #f3f9f5 100%); }
.hero h2 { font-size: 19px; letter-spacing: -.2px; }
.hero-lead { color: var(--muted); margin: 4px 0 14px; }
.insights { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.insight { display: block; color: inherit; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; transition: transform .2s ease, box-shadow .2s ease; }
.insight:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(16, 24, 40, .07); text-decoration: none; }
.insight .big { font-size: 22px; font-weight: 700; letter-spacing: -.4px; color: var(--text); font-variant-numeric: tabular-nums; }
.insight .what { color: var(--muted); font-size: 13px; }
.insight .go { font-size: 12.5px; font-weight: 600; margin-top: 6px; color: var(--blue); }
@media (max-width: 1100px) { .hero { grid-template-columns: 1fr; } .hero .illus { max-width: 260px; } }
@media (max-width: 760px) { .insights { grid-template-columns: 1fr; } }

/* Mise en vigueur d'une version */
.when { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.when label { display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--border-strong); border-radius: 12px; padding: 14px; cursor: pointer; transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease; }
.when label:hover { border-color: #9fb9a9; }
.when input { margin-top: 3px; accent-color: var(--primary); }
.when label.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px rgba(20, 67, 42, .08); }
.when .t { font-weight: 600; }
.when .d { color: var(--muted); font-size: 13px; }
@media (max-width: 760px) { .when { grid-template-columns: 1fr; } }
.golive { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 18px; align-items: center; }
@media (max-width: 760px) { .golive { grid-template-columns: 1fr; } .golive .illus { max-width: 180px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Cartes cliquables (bibliothèque de modèles) */
a.box-link { display: block; color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
a.box-link:hover { border-color: var(--primary); box-shadow: 0 6px 18px rgba(29,63,143,.12); transform: translateY(-1px); }
.box-go { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--primary); }
.box-go i { font-size: 11px; transition: transform .15s; }
a.box-link:hover .box-go i { transform: translateX(3px); }
@media (prefers-reduced-motion: reduce) { a.box-link, a.box-link:hover, .box-go i { transition: none; transform: none; } }

/* Compléments de l'application */
.card-body form .form-row, .card-body form .form-grid { margin-bottom: 12px; }
.card-body form .form-grid .form-row { margin-bottom: 0; }
.field-error { color: var(--red); font-size: 12.5px; margin-top: 4px; }
.form-row.has-error .input { border-color: var(--red); }
.checks-inline { display: flex; flex-wrap: wrap; gap: 6px 16px; }
button.link { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; cursor: pointer; }
button.link:hover { text-decoration: underline; }
button.auth-channel { background: #fff; font: inherit; text-align: left; cursor: pointer; }
.qr-box svg { display: block; margin: 0 auto 10px; }
