/* Démo — Suivi clients VR propulsé par l'IA (données fictives) */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8ef;
  --text: #1c2533;
  --muted: #64748b;
  --nav: #13233a;
  --nav-2: #1b3150;
  --nav-text: #c9d6e8;
  --accent: #e07a1f;
  --accent-soft: #fdf0e3;
  --blue: #2563eb;
  --blue-soft: #e8f0fe;
  --green: #16a34a;
  --green-soft: #e6f6ec;
  --red: #dc2626;
  --red-soft: #fdecec;
  --yellow: #ca8a04;
  --yellow-soft: #fdf6dd;
  --purple: #7c3aed;
  --purple-soft: #f1eafe;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }

/* ---------- Mise en page ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; flex-shrink: 0;
  background: var(--nav); color: var(--nav-text);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { padding: 20px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand a { color: #fff; display: flex; gap: 10px; align-items: center; text-decoration: none; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 10px; background: var(--accent);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 1.1rem;
}
.brand .name { font-weight: 700; font-size: .98rem; line-height: 1.2; }
.brand .sub { font-size: .75rem; color: var(--nav-text); opacity: .8; }
.nav { padding: 12px 10px 20px; flex: 1; }
.nav .group { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .6; padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  color: var(--nav-text); padding: 8px 12px; border-radius: 8px; font-size: .92rem;
  text-decoration: none;
}
.nav a:hover { background: var(--nav-2); color: #fff; }
.nav a.active { background: var(--accent); color: #fff; font-weight: 600; }
.nav .ico { width: 20px; text-align: center; }
.nav .count { margin-left: auto; background: rgba(255,255,255,.15); border-radius: 999px; font-size: .72rem; padding: 0 8px; }
.sidebar .foot { padding: 14px 20px; font-size: .75rem; opacity: .7; border-top: 1px solid rgba(255,255,255,.08); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 28px; display: flex; gap: 16px; align-items: center; position: sticky; top: 0; z-index: 5;
}
.topbar .search {
  flex: 1 1 320px; max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; background: var(--surface-2); color: var(--muted); font-size: .9rem;
}
.topbar .spacer { flex: 1 1 0; }
.topbar .user { display: flex; gap: 10px; align-items: center; font-size: .88rem; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--blue-soft); color: var(--blue);
  display: inline-grid; place-items: center; font-weight: 700; font-size: .8rem; flex-shrink: 0;
}
.avatar.orange { background: var(--accent-soft); color: var(--accent); }
.avatar.green { background: var(--green-soft); color: var(--green); }
.avatar.purple { background: var(--purple-soft); color: var(--purple); }
.menu-btn { display: none; border: 0; background: none; font-size: 1.4rem; cursor: pointer; }
.demo-flag {
  background: var(--yellow-soft); color: #854d0e; font-size: .75rem; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}

.content { padding: 24px 28px 48px; max-width: 1400px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin: 0; }
.crumbs { font-size: .82rem; color: var(--muted); margin-bottom: 6px; }

/* ---------- Composants ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px;
}
.card + .card { margin-top: 16px; }
.grid > .card + .card, .grid > * + .card { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.stack > * + * { margin-top: 16px; }

.kpi .label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 1.9rem; font-weight: 700; margin: 2px 0; }
.kpi .delta { font-size: .82rem; }
.up { color: var(--green); }
.down { color: var(--red); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 8px;
  font-size: .88rem; font-weight: 600; cursor: pointer; text-decoration: none; font-family: inherit;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #c96a14; }
.btn.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: .8rem; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap;
}
.badge.blue { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.badge.green { background: var(--green-soft); color: var(--green); border-color: transparent; }
.badge.red { background: var(--red-soft); color: var(--red); border-color: transparent; }
.badge.yellow { background: var(--yellow-soft); color: #92400e; border-color: transparent; }
.badge.orange { background: var(--accent-soft); color: #b45309; border-color: transparent; }
.badge.purple { background: var(--purple-soft); color: var(--purple); border-color: transparent; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcff; }
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.strong { font-weight: 600; }
.right { text-align: right; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a, .tabs button {
  padding: 10px 16px; border: 0; background: none; font: inherit; font-weight: 600; font-size: .9rem;
  color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; text-decoration: none;
}
.tabs a.active, .tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters .chip {
  border: 1px solid var(--border); background: var(--surface); padding: 6px 12px; border-radius: 999px;
  font-size: .82rem; cursor: pointer; font-family: inherit;
}
.filters .chip.active { background: var(--nav); color: #fff; border-color: var(--nav); }
.input, select.input, textarea.input {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font: inherit; font-size: .9rem;
  background: var(--surface); color: var(--text);
}

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }

.bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar.blue > span { background: var(--blue); }
.bar.green > span { background: var(--green); }

.callout { border-left: 4px solid var(--blue); background: var(--blue-soft); padding: 12px 16px; border-radius: 8px; font-size: .9rem; }
.callout.orange { border-color: var(--accent); background: var(--accent-soft); }
.callout.green { border-color: var(--green); background: var(--green-soft); }
.callout.red { border-color: var(--red); background: var(--red-soft); }

/* Graphique à barres simple */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart .stack-bar { width: 100%; max-width: 38px; display: flex; flex-direction: column-reverse; border-radius: 6px 6px 0 0; overflow: hidden; }
.chart .seg-a { background: var(--accent); }
.chart .seg-b { background: var(--blue); }
.chart .lbl { font-size: .72rem; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: .8rem; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* Score sur 10 */
.score {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 1.15rem;
  background: conic-gradient(var(--accent) calc(var(--v) * 36deg), var(--surface-2) 0);
  position: relative; flex-shrink: 0;
}
.score::before { content: ""; position: absolute; inset: 7px; background: var(--surface); border-radius: 50%; }
.score span { position: relative; }
.score.green { background: conic-gradient(var(--green) calc(var(--v) * 36deg), var(--surface-2) 0); }
.score.blue { background: conic-gradient(var(--blue) calc(var(--v) * 36deg), var(--surface-2) 0); }

/* Conversation Coach IA */
.chat { display: flex; flex-direction: column; gap: 14px; max-height: 620px; overflow-y: auto; padding-right: 4px; }
.msg { display: flex; gap: 10px; max-width: 88%; }
.msg .bubble { padding: 11px 14px; border-radius: 14px; font-size: .92rem; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg.me .bubble { background: var(--nav); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai .bubble { background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg .meta { font-size: .72rem; color: var(--muted); margin-top: 4px; }
.msg.me .meta { text-align: right; }
.voice { display: flex; gap: 6px; align-items: center; font-size: .78rem; opacity: .85; margin-bottom: 4px; }
.wave { display: inline-flex; gap: 2px; align-items: center; height: 14px; }
.wave i { width: 3px; background: currentColor; border-radius: 2px; opacity: .8; }
.composer { display: flex; gap: 8px; margin-top: 14px; border-top: 1px solid var(--border); padding-top: 14px; }
.composer .input { flex: 1; }
.mic {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 1.1rem; cursor: pointer;
}
.extract { font-size: .88rem; }
.extract dt { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 10px; }
.extract dd { margin: 2px 0 0; }

.draft { border: 1px dashed var(--accent); border-radius: 10px; padding: 14px 16px; background: #fffdf9; font-size: .9rem; }
.draft .hdr { font-size: .8rem; color: var(--muted); margin-bottom: 8px; }
.draft .body { white-space: pre-line; }

/* Chronologie */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline .ev { position: relative; padding-bottom: 16px; }
.timeline .ev::before {
  content: ""; position: absolute; left: -20px; top: 5px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent);
}
.timeline .ev.blue::before { border-color: var(--blue); }
.timeline .ev.green::before { border-color: var(--green); }
.timeline .ev .when { font-size: .78rem; color: var(--muted); }

/* Pipeline */
.pipeline { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.pipeline .step { text-align: center; padding: 10px 6px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: .78rem; color: var(--muted); }
.pipeline .step.done { background: var(--green-soft); color: var(--green); border-color: transparent; font-weight: 600; }
.pipeline .step.now { background: var(--accent); color: #fff; border-color: transparent; font-weight: 700; }

/* Checklist 17 h */
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.check:last-child { border-bottom: 0; }
.check .box { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--border); flex-shrink: 0; display: grid; place-items: center; font-size: .8rem; cursor: pointer; }
.check.ok .box { background: var(--green); border-color: var(--green); color: #fff; }
.check.warn .box { border-color: var(--yellow); color: var(--yellow); }

/* Flux architecture */
.flow { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; }
.flow .node { flex: 1; min-width: 150px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: .85rem; }
.flow .node b { display: block; margin-bottom: 4px; }
.flow .arrow { align-self: center; color: var(--muted); font-size: 1.3rem; }

/* Entonnoir */
.funnel { display: flex; flex-direction: column; gap: 6px; }
.f-row { display: flex; align-items: center; gap: 10px; font-size: .85rem; }
.f-lbl { width: 78px; color: var(--muted); flex-shrink: 0; }
.f-track { flex: 1; background: var(--surface-2); border-radius: 6px; }
.f-bar { background: linear-gradient(90deg, var(--accent), #f0a35e); color: #fff; font-weight: 700; font-size: .78rem; padding: 4px 8px; border-radius: 6px; white-space: nowrap; min-width: 28px; }
.f-pas { width: 44px; text-align: right; font-size: .8rem; flex-shrink: 0; }

/* Sélecteur de vendeur */
.picker { display: flex; gap: 6px; flex-wrap: wrap; }
.picker a { display: inline-flex; gap: 8px; align-items: center; padding: 5px 12px 5px 5px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: .84rem; text-decoration: none; }
.picker a.active { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.picker .avatar { width: 26px; height: 26px; font-size: .7rem; }

/* Rôle */
.role-select { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font: inherit; font-size: .85rem; background: var(--surface-2); color: var(--text); }
.role-banner { margin-bottom: 16px; }

/* Téléphone (vue mobile) */
.phone { width: 360px; max-width: 100%; border: 10px solid #111827; border-radius: 40px; background: var(--surface); overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.phone .notch { height: 26px; background: #111827; width: 140px; margin: 0 auto; border-radius: 0 0 16px 16px; }
.phone .p-head { padding: 10px 14px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.phone .p-body { padding: 12px; height: 520px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.phone .msg { max-width: 92%; }
.phone .msg .bubble { font-size: .84rem; }
.phone .p-foot { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); align-items: center; }
.phone .p-tabs { display: flex; justify-content: space-around; padding: 8px 0 12px; border-top: 1px solid var(--border); font-size: .7rem; color: var(--muted); text-align: center; }
.phone .p-tabs .on { color: var(--accent); font-weight: 700; }
.phone-row { display: flex; gap: 32px; flex-wrap: wrap; justify-content: center; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--nav); color: #fff; padding: 12px 18px;
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: .9rem; z-index: 50;
  opacity: 0; transform: translateY(10px); transition: all .25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }

/* Accueil */
.hero {
  background: linear-gradient(120deg, var(--nav) 0%, var(--nav-2) 60%, #2a4a74 100%); color: #fff;
  border-radius: var(--radius); padding: 26px 28px; margin-bottom: 20px; position: relative; overflow: hidden;
}
.hero h1 { font-size: 1.55rem; }
.hero p { color: #d6e2f3; margin: 0; max-width: 720px; }
.hero .rv { position: absolute; right: 24px; bottom: -6px; font-size: 6rem; opacity: .14; }
.site-card { display: flex; flex-direction: column; gap: 10px; }
.site-card .loc { font-size: .82rem; color: var(--muted); }

/* Impression */
@media print {
  .sidebar, .topbar, .btn, .no-print { display: none !important; }
  .content { padding: 0; }
  body { background: #fff; }
}

/* Responsive */
@media (max-width: 1100px) {
  .topbar .search { display: none; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .g-2-1, .g-1-2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; left: -270px; z-index: 40; transition: left .2s; }
  .sidebar.open { left: 0; }
  .menu-btn { display: block; }
  .g2 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .topbar .search { display: none; }
  .pipeline { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .g4 { grid-template-columns: 1fr; }
  .msg { max-width: 100%; }
  .demo-flag { display: none; }
}
