/* Prospection — design repris de Closer CRM (Archivo, violet signal, tiroir lead) */
:root {
  --paper: #EEF1F4;
  --surface: #FFFFFF;
  --sunken: #F6F8FA;
  --ink: #1A2333;
  --muted: #64708A;
  --line: #D9DFE7;
  --signal: #9C1CF2;
  --signal-ink: #FFFFFF;
  --signal-bg: #F3E8FE;
  --bull: #1E9E6A;
  --bear: #D2483C;
  --amber: #B97C0A;
  --amber-bg: #FFF4DC;
  --bull-bg: #E3F5EC;
  --bear-bg: #FBE7E5;
  --mail: #3E63E6;
  --mail-bg: #E7EDFF;
  --bubble-in: #FFFFFF;
  --bubble-out: #DDE6FF;
  --bubble-wa: #DCF4E7;
  --chat-bg: #E7ECF2;
  --shadow: 0 1px 0 rgba(26,35,51,.06);
  --drawer-shadow: -24px 0 48px rgba(26,35,51,.14);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121722; --surface: #1A2130; --sunken: #151B27; --ink: #E6EAF2; --muted: #93A0B8;
    --line: #2A3346; --signal: #B45CFF; --signal-bg: #2C1F45; --bull: #3CC48D; --bear: #F06B5F; --amber: #E3A93A; --amber-bg: #3A2E14; --bull-bg: #173528; --bear-bg: #3A1E1C;
    --mail: #7D97FF; --mail-bg: #1F2A4D; --bubble-in: #232B3C; --bubble-out: #26386E; --bubble-wa: #1B3A2C; --chat-bg: #151B27; --shadow: none; --drawer-shadow: -24px 0 48px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121722; --surface: #1A2130; --sunken: #151B27; --ink: #E6EAF2; --muted: #93A0B8;
  --line: #2A3346; --signal: #B45CFF; --signal-bg: #2C1F45; --bull: #3CC48D; --bear: #F06B5F; --amber: #E3A93A; --amber-bg: #3A2E14; --bull-bg: #173528; --bear-bg: #3A1E1C;
  --mail: #7D97FF; --mail-bg: #1F2A4D; --bubble-in: #232B3C; --bubble-out: #26386E; --bubble-wa: #1B3A2C; --chat-bg: #151B27; --shadow: none; --drawer-shadow: -24px 0 48px rgba(0,0,0,.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font-family: 'Archivo', system-ui, sans-serif; font-size: 15px; line-height: 1.45; font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--signal); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; }
h1 { font-size: 28px; font-weight: 750; font-stretch: 108%; letter-spacing: -.015em; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--bear); min-height: 1em; margin: 0; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ---------- Barre du haut ---------- */
.top { display: flex; align-items: center; gap: 18px; padding: 12px 24px; background: var(--surface); position: sticky; top: 0; z-index: 5; box-shadow: inset 0 -1px 0 var(--line); }
.top::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--signal); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-stretch: 112%; font-size: 18px; letter-spacing: -.01em; white-space: nowrap; text-decoration: none; color: inherit; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--ink); color: var(--surface); font-size: 15px; font-weight: 800; flex: none; }
.brand-mark i { display: block; width: 12px; height: 12px; border-radius: 3px; background: var(--signal); transform: rotate(45deg); }
.nav { display: flex; gap: 2px; flex: none; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 600; padding: 7px 12px; border-radius: 8px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--paper); }
.nav-badge { min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--signal); color: #fff; font-size: 11.5px; font-weight: 700; text-align: center; line-height: 18px; }
.conn { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; padding: 5px 11px; border-radius: 999px; white-space: nowrap; text-decoration: none; color: var(--ink); background: var(--paper); }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.conn.ok i { background: var(--bull); }
.conn.warn { background: var(--amber-bg); color: var(--amber); }
.conn.warn i { background: var(--amber); }
.top .spacer { flex: 1; }
.search { flex: 0 1 300px; min-width: 140px; position: relative; }
.search input { width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--sunken); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--drawer-shadow); padding: 6px; z-index: 6; display: grid; gap: 2px; max-height: 360px; overflow: auto; }
.search-results button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; display: grid; }
.search-results button:hover, .search-results button:focus-visible { background: var(--paper); }
.search-results small { color: var(--muted); }
.me { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); font-weight: 700; font-size: 13px; display: grid; place-items: center; flex: none; }
.me:hover { border-color: var(--muted); }
.me-menu { position: absolute; right: 24px; top: 58px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--drawer-shadow); padding: 6px; display: grid; min-width: 220px; z-index: 7; }
.me-menu div { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 14px; }
.me-menu small { display: block; color: var(--muted); }
.me-menu button, .me-menu a { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; font-size: 14px; color: var(--ink); text-decoration: none; }
.me-menu button:hover, .me-menu a:hover { background: var(--paper); }

/* ---------- Boutons, champs ---------- */
.btn { border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 8px; font-weight: 600; white-space: nowrap; text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; font-size: 14.5px; line-height: 1.3; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.go, .btn.good { background: var(--bull); color: #fff; border-color: var(--bull); }
.btn.warn { background: var(--amber-bg); border-color: transparent; color: var(--amber); }
.btn.danger { color: var(--bear); }
.btn.ghost { background: transparent; }
.btn.sm, .btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--signal); font-weight: 600; }
input, select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: var(--sunken); width: 100%; font-size: 14px; color: var(--ink); }
textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--signal); }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
label > input, label > select, label > textarea { color: var(--ink); }
.fields { display: grid; gap: 12px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink); }
.check input { width: auto; }
label.inline { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--muted); }
.days { display: flex; gap: 4px; flex-wrap: wrap; }
.days label { display: inline-flex; }
.days input { display: none; }
.days span { padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 13px; color: var(--muted); background: var(--surface); }
.days input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- Pages ---------- */
.view { outline: none; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 24px 64px; }
.wrap.narrow { max-width: 980px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p, .lede { color: var(--muted); margin: 6px 0 0; max-width: 70ch; }
.page-head > div > a.small { text-decoration: none; font-weight: 600; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; min-width: 0; }
.panel > h2, .panel > h3 { margin-bottom: 12px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush > h2, .panel.flush > h3 { padding: 16px 18px 0; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.notice { background: var(--amber-bg); color: var(--ink); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.notice.bad { background: var(--bear-bg); }
.notice.good { background: var(--bull-bg); }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 8px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
code { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; font-size: 12.5px; }
code.copy { cursor: pointer; }

/* Tableaux */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--sunken); }
.num { text-align: right; }
.table-wrap { overflow-x: auto; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); gap: 8px; }
.panel .toolbar { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); align-items: center; }
.panel .toolbar input, .panel .toolbar select { width: auto; }
.panel .toolbar input[type=search] { min-width: 240px; flex: 1; }
.bulkbar { background: var(--ink); color: var(--paper); padding: 10px 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.bulkbar select { width: auto; background: var(--surface); color: var(--ink); }

/* Pastilles */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--paper); color: var(--muted); white-space: nowrap; }
.pill.email { background: var(--mail-bg); color: var(--mail); }
.pill.whatsapp { background: var(--bull-bg); color: var(--bull); }
.pill.ok, .pill.active, .pill.APPROVED, .pill.repondu, .pill.terminee { background: var(--bull-bg); color: var(--bull); }
.pill.pause, .pill.PENDING, .pill.brouillon { background: var(--amber-bg); color: var(--amber); }
.pill.echec, .pill.arretee, .pill.REJECTED, .pill.PAUSED, .pill.DISABLED { background: var(--bear-bg); color: var(--bear); }
.pill.en_cours { background: var(--signal-bg); color: var(--signal); }
.pill.stage::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.pill.stage { background: var(--paper); color: var(--ink); }
.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); margin: 0 3px 3px 0; background: var(--surface); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--signal); color: #fff; font-size: 11.5px; font-weight: 700; text-align: center; line-height: 18px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; margin-top: 6px; }
.dot.email { background: var(--mail); }
.dot.whatsapp { background: var(--bull); }
.dot.bad { background: var(--bear); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; }
.status-dot.ok { background: var(--bull); }
.status-dot.warn { background: var(--amber); }

/* ---------- Pipeline ---------- */
.funnel { display: grid; grid-template-columns: repeat(5, 1fr) auto; padding: 20px 24px 8px; }
.f-step { position: relative; padding: 0 18px 0 0; }
.f-step + .f-step { padding-left: 18px; border-left: 1px solid var(--line); }
.f-value { font-size: 34px; font-weight: 700; font-stretch: 85%; line-height: 1; letter-spacing: -.02em; }
.f-label { color: var(--muted); font-size: 13px; margin-top: 6px; }
.f-rate { position: absolute; top: 2px; right: 14px; font-size: 13px; font-weight: 600; color: var(--bull); }
.f-rate.low { color: var(--bear); }
.f-bar { height: 4px; border-radius: 2px; background: var(--line); margin-top: 10px; overflow: hidden; }
.f-bar i { display: block; height: 100%; background: var(--ink); opacity: .85; }
.f-cash { padding-left: 24px; border-left: 1px solid var(--line); text-align: right; }
.f-cash .f-value { color: var(--bull); }
.toolbar { display: flex; gap: 10px; align-items: center; padding: 14px 24px 10px; flex-wrap: wrap; }
.toolbar .hint { color: var(--muted); font-size: 13px; }
.toolbar select { width: auto; padding: 4px 10px; border-radius: 999px; font-size: 13px; background: var(--surface); }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-size: 13px; text-decoration: none; color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--bull); box-shadow: 0 0 0 3px var(--bull-bg); }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 1fr); gap: 10px; padding: 0 24px 32px; overflow-x: auto; align-items: start; }
.col { background: var(--sunken); border: 1px solid var(--line); border-top: 3px solid var(--st, var(--line)); border-radius: 10px; min-height: 160px; display: flex; flex-direction: column; max-height: calc(100vh - 250px); }
.col-head { display: flex; align-items: baseline; padding: 12px 14px 8px; font-weight: 700; gap: 8px; }
.col-head::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--st, var(--muted)); flex: none; }
.col-head span { margin-left: auto; color: var(--muted); font-weight: 500; font-size: 13px; }
.col-sum { padding: 0 14px 6px; font-size: 12.5px; color: var(--muted); margin-top: -4px; }
.col-body { padding: 4px 8px 10px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.col.drop { outline: 2px dashed var(--signal); outline-offset: -4px; }
.col-empty { color: var(--muted); font-size: 13px; padding: 8px 6px; }
.col-more { font-size: 13px; padding: 4px 6px; text-decoration: none; font-weight: 600; }
.card { text-align: left; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; box-shadow: var(--shadow); display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; min-width: 0; }
.card > * { min-width: 0; }
.card:hover { border-color: var(--muted); }
.card[draggable="true"] { cursor: grab; }
.card .name { font-weight: 650; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.card .name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta { color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; gap: 8px; }
.card .meta span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .preview { font-size: 12.5px; color: var(--muted); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card.unread { border-color: var(--signal); }
.card.unread .name > span:first-child { font-weight: 800; }
.card.unread .preview { color: var(--ink); }
.card .udot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); margin-right: 6px; vertical-align: 1px; }
.card.attention { border-left: 3px solid var(--amber); }
.card.dragging { opacity: .5; }
.flag { font-size: 12px; color: var(--amber); font-weight: 600; }
.seqflag { font-size: 12px; color: var(--signal); font-weight: 600; }
.when { font-size: 12.5px; white-space: nowrap; }
.score { font-size: 12px; font-weight: 700; border-radius: 4px; padding: 1px 6px; background: var(--paper); color: var(--ink); }
.score.hot { background: var(--bull); color: #fff; }

/* ---------- Tiroir lead ---------- */
.scrim { position: fixed; inset: 0; background: rgba(18,23,34,.35); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 9; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(860px, 100vw); background: var(--surface); transform: translateX(100%); transition: transform .22s ease-out, visibility 0s .22s; visibility: hidden; display: grid; grid-template-rows: auto 1fr; z-index: 10; }
.drawer.open { transform: none; visibility: visible; box-shadow: var(--drawer-shadow); transition: transform .22s ease-out; }
@media (prefers-reduced-motion: reduce) { .drawer, .scrim { transition: none; } }
.d-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.d-title { display: flex; align-items: center; gap: 12px; }
.d-title h2 { margin: 0; font-size: 22px; font-weight: 750; font-stretch: 108%; letter-spacing: -.01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-close { border: 0; background: var(--paper); width: 34px; height: 34px; border-radius: 50%; font-size: 18px; line-height: 1; color: var(--muted); }
.d-contact { color: var(--muted); font-size: 14px; display: flex; gap: 14px; flex-wrap: wrap; }
.d-contact a { color: inherit; }
.d-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.d-actions select { width: auto; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; }
.banner { background: var(--amber-bg); color: var(--ink); border-radius: 8px; padding: 10px 12px; font-size: 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.banner.lost { background: var(--bear-bg); }
.outcome { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 12px; border-radius: 8px; background: var(--sunken); border: 1px solid var(--line); }
.outcome > span { font-weight: 650; font-size: 14px; margin-right: 4px; }
.d-body { display: grid; grid-template-columns: 1fr 290px; min-height: 0; }
.chat { display: grid; grid-template-rows: 1fr auto; min-height: 0; background: var(--chat-bg); }
.thread { overflow-y: auto; padding: 18px 18px 8px; display: flex; flex-direction: column; gap: 6px; }
.bubble { max-width: 82%; padding: 8px 11px 6px; border-radius: 10px; white-space: pre-wrap; font-size: 14px; box-shadow: var(--shadow); overflow-wrap: anywhere; }
.bubble.in { background: var(--bubble-in); align-self: flex-start; border-top-left-radius: 2px; }
.bubble.out { background: var(--bubble-out); align-self: flex-end; border-top-right-radius: 2px; }
.bubble.out.whatsapp { background: var(--bubble-wa); }
.bubble .b-who { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.bubble .b-meta { display: block; font-size: 11.5px; color: var(--muted); text-align: right; margin-top: 2px; }
.bubble .b-err { display: block; font-size: 12px; color: var(--bear); margin-top: 2px; }
.tick { letter-spacing: -3px; margin-left: 3px; }
.tick.read { color: #3D8FD1; }
.tick.bad { color: var(--bear); font-weight: 700; letter-spacing: 0; }
.sys { align-self: center; font-size: 12.5px; color: var(--muted); padding: 2px 10px; text-align: center; }
.sys.day { background: var(--surface); border-radius: 999px; margin: 8px 0 4px; box-shadow: var(--shadow); }
.composer { border-top: 1px solid var(--line); background: var(--surface); padding: 10px 12px; display: grid; gap: 8px; }
.composer .tabs { display: flex; gap: 4px; }
.composer .tabs button { border: 0; background: none; padding: 4px 10px; border-radius: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.composer .tabs button[aria-selected="true"] { background: var(--paper); color: var(--ink); }
.composer .send-row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; min-height: 44px; }
.composer .note { font-size: 12.5px; color: var(--muted); }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.side { border-left: 1px solid var(--line); overflow-y: auto; padding: 16px; display: grid; gap: 20px; align-content: start; }
.side h3 { margin: 0 0 8px; }
.ticket { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 0; }
.ticket div { display: grid; gap: 2px; padding: 8px 10px; font-size: 13.5px; }
.ticket div + div { border-top: 1px dashed var(--line); }
.ticket dt { color: var(--muted); font-size: 12.5px; }
.ticket dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.seqs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.seqs li { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; display: grid; gap: 4px; }
.seqs li b { font-size: 13.5px; }
.seqs .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); flex-wrap: wrap; }
.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--signal); }
.seqs li.done .progress i { background: var(--bull); }
.seqs li.stopped { opacity: .65; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; }
.timeline li { display: grid; grid-template-columns: 10px 1fr; gap: 8px; }
.timeline li::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--line); margin-top: 6px; }
.timeline li.key::before { background: var(--signal); }
.timeline li.good::before { background: var(--bull); }
.timeline li.bad::before { background: var(--bear); }
.timeline time { color: var(--muted); display: block; font-size: 12px; }
.timeline .note-text { background: var(--amber-bg); border-radius: 6px; padding: 6px 8px; white-space: pre-wrap; margin-top: 2px; }
.meeting { border-radius: 8px; padding: 10px 12px; background: var(--sunken); border: 1px solid var(--line); font-size: 14px; }
.meeting b { display: block; font-size: 16px; }
.tpl-pick { display: grid; gap: 6px; }
.param-row { display: grid; grid-template-columns: 120px 1fr; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); margin-top: 6px; }

/* ---------- Réglages ---------- */
.setting { display: grid; grid-template-columns: 250px 1fr; gap: 28px; padding: 26px 0; border-top: 1px solid var(--line); }
.setting > header h2 { font-size: 17px; margin: 0 0 6px; display: flex; gap: 8px; align-items: center; }
.setting > header p { color: var(--muted); font-size: 14px; margin: 0; }
.setting .body { display: grid; gap: 14px; align-content: start; min-width: 0; }
.result { font-size: 13.5px; padding: 9px 12px; border-radius: 8px; background: var(--sunken); border: 1px solid var(--line); }
.result.ok { background: var(--bull-bg); border-color: transparent; }
.result.err { background: var(--amber-bg); border-color: transparent; }
.hooks { display: grid; gap: 6px; }
.hooks div { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.hooks span { color: var(--muted); min-width: 210px; }
.team { width: 100%; border-collapse: collapse; font-size: 14px; }
.team td { padding: 9px 8px 9px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.team td:last-child { text-align: right; white-space: nowrap; padding-right: 0; }
.team small { display: block; color: var(--muted); font-size: 12.5px; }

/* ---------- KPI ---------- */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button, .seg a { border: 0; background: none; padding: 7px 11px; font-size: 13.5px; font-weight: 600; color: var(--muted); text-decoration: none; }
.seg > * + * { border-left: 1px solid var(--line) !important; }
.seg [aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.kpi-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.kpi-filters select { width: auto; max-width: 220px; background: var(--surface); }
.funnel2 { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px 22px 18px; margin-bottom: 18px; }
.funnel2 h2, .kpi-block h2 { font-size: 15px; margin: 0 0 14px; font-weight: 700; }
.fstages { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: end; }
.fstage { position: relative; padding: 0 10px; }
.fstage + .fstage { border-left: 1px dashed var(--line); }
.fstage .v { font-size: 34px; font-weight: 750; font-stretch: 85%; letter-spacing: -.02em; line-height: 1; }
.fstage .l { color: var(--muted); font-size: 13px; margin: 6px 0 12px; min-height: 2.8em; }
.fstage .bar { height: 120px; display: flex; align-items: flex-end; }
.fstage .bar i { display: block; width: 100%; border-radius: 4px 4px 0 0; background: var(--ink); opacity: .9; min-height: 2px; }
.fstage:last-child .bar i { background: var(--signal); opacity: 1; }
.fstage .conv { display: block; margin-top: 3px; font-size: 12px; font-weight: 600; }
.fstage .conv.low { color: var(--bear); }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi-block { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; min-width: 0; overflow: hidden; }
.kpi-block.wide { grid-column: span 2; }
.kpi-block.full { grid-column: 1 / -1; }
.stats { margin: 0; display: grid; }
.stats div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.stats div:last-child { border-bottom: 0; }
.stats dt { color: var(--muted); font-size: 13.5px; }
.stats dd { margin: 0; font-weight: 700; font-size: 15px; text-align: right; flex: none; max-width: 60%; }
.stats dd small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.stats .hero dd { font-size: 24px; font-stretch: 90%; }
.stats dd.bad { color: var(--bear); }
.stats dd.good { color: var(--bull); }
.now-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.now-list li { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.now-list a { color: inherit; }
.ktable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ktable th { text-align: right; padding: 6px 8px; }
.ktable td { text-align: right; padding: 8px; white-space: nowrap; }
.ktable th:first-child, .ktable td:first-child { text-align: left; padding-left: 0; white-space: normal; }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.activity li:last-child { border-bottom: 0; }
.activity time { color: var(--muted); font-size: 12px; min-width: 88px; }

/* ---------- Campagnes : séquence ---------- */
.steps-wrap { position: relative; }
.sequence { position: relative; padding-left: 40px; }
.sequence::before { content: ''; position: absolute; left: 13px; top: 18px; bottom: 60px; width: 1px; background: var(--line); }
.step { position: relative; margin-bottom: 8px; }
.step .node { position: absolute; left: -40px; top: 14px; width: 27px; height: 27px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; background: var(--paper); border: 1px solid var(--line); color: var(--ink); }
.step.whatsapp .node { background: var(--bull-bg); border-color: transparent; color: var(--bull); }
.step.email .node { background: var(--mail-bg); border-color: transparent; color: var(--mail); }
.step-body { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 12px; display: grid; gap: 10px; }
.step-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.step-head select { width: auto; }
.step-title { font-size: 15px; font-weight: 700; white-space: nowrap; }
.wait { position: relative; display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 13.5px; color: var(--muted); padding: 4px 0; flex-wrap: wrap; }
.wait input { width: 64px; padding: 4px 6px; }
.wait select { width: auto; padding: 4px 6px; }
.wait::before { content: ''; position: absolute; left: -31px; top: 50%; width: 9px; height: 9px; margin-top: -5px; border-radius: 50%; background: var(--paper); border: 1px solid var(--muted); }
.step-stats { display: flex; gap: 14px; font-size: 13px; color: var(--muted); padding-top: 8px; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.step-stats b { color: var(--ink); }
.add-step { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.vars { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); }
.vars code, .vars button { border: 1px dashed var(--line); background: var(--surface); border-radius: 6px; padding: 2px 7px; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.tpl-preview { background: var(--bubble-wa); border-radius: 10px 10px 10px 2px; padding: 9px 12px; font-size: 14px; white-space: pre-wrap; max-width: 460px; box-shadow: var(--shadow); color: var(--ink); }
.presets { display: grid; gap: 6px; }
.preset { display: grid !important; grid-template-columns: auto 1fr; gap: 4px 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; color: var(--ink) !important; font-size: 14px !important; background: var(--surface); }
.preset input { margin: 3px 0 0; grid-row: span 2; }
.preset > span { display: grid; gap: 2px; }
.preset:has(input:checked) { border-color: var(--signal); box-shadow: inset 0 0 0 1px var(--signal); }

/* ---------- Templates ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.tpl-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 10px; align-content: start; }
.tpl-card header { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.tpl-card header b { overflow-wrap: anywhere; }
.tpl-phone { background: var(--chat-bg); border-radius: 10px; padding: 12px; display: grid; gap: 6px; }
.tpl-bubble { background: var(--surface); border-radius: 2px 10px 10px 10px; padding: 8px 11px; font-size: 14px; white-space: pre-wrap; box-shadow: var(--shadow); overflow-wrap: anywhere; }
.tpl-bubble .h { font-weight: 700; display: block; margin-bottom: 4px; }
.tpl-bubble .f { display: block; color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.tpl-bubble .v { background: var(--signal-bg); color: var(--signal); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.tpl-btns { display: grid; gap: 4px; }
.tpl-btns span { background: var(--surface); border-radius: 8px; padding: 7px; text-align: center; color: #1F7AE0; font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow); }
.tpl-editor { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.tpl-editor .sticky { position: sticky; top: 90px; }
.btn-rows { display: grid; gap: 8px; }
.btn-row { display: grid; grid-template-columns: 140px 1fr 1fr auto; gap: 8px; align-items: center; }
.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs-line a { padding: 9px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs-line a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--signal); }

/* ---------- Conversations ---------- */
.convs { list-style: none; margin: 0; padding: 0; }
.conv-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.conv-row:last-child { border-bottom: 0; }
.conv-row:hover { background: var(--sunken); }
.conv-dot { width: 8px; height: 8px; border-radius: 50%; }
.conv-row.unread .conv-dot { background: var(--signal); }
.conv-row.unread b { font-weight: 800; }
.conv-prev { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70ch; }
.conv-row.unread .conv-prev { color: var(--ink); }
.conv-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* ---------- Import ---------- */
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 40px; text-align: center; background: var(--surface); cursor: pointer; display: block; }
.drop.over { border-color: var(--signal); background: var(--signal-bg); }
.drop h3 { font-size: 17px; color: var(--ink); }
.map-table td { vertical-align: middle; }
.map-table select { min-width: 180px; }

/* ---------- Connexion, modales, toasts ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--paper); }
.login-card { background: var(--surface); border: 1px solid var(--line); padding: 28px; border-radius: 14px; width: 100%; max-width: 380px; display: grid; gap: 14px; box-shadow: var(--shadow); border-top: 3px solid var(--signal); }
.login-card h1 { display: flex; align-items: center; gap: 10px; font-size: 24px; }
.login-card p { margin: 0; color: var(--muted); }
.modal { position: fixed; inset: 0; background: rgba(18,23,34,.4); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; width: min(500px, calc(100vw - 32px)); max-height: 90vh; overflow: auto; }
.modal-card h2 { margin-bottom: 12px; font-size: 18px; }
.modal-card p { color: var(--muted); font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 60; justify-items: center; }
.toast { background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 8px; font-size: 14px; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--bear); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .search { width: 200px; } .tpl-editor { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .funnel { grid-template-columns: repeat(3, 1fr); row-gap: 18px; }
  .f-step:nth-child(4) { border-left: 0; padding-left: 0; }
  .f-cash { text-align: left; padding-left: 18px; }
  .d-body { grid-template-columns: 1fr; overflow-y: auto; }
  .chat { min-height: 60vh; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
  .setting { grid-template-columns: 1fr; gap: 12px; }
  .fstages { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 22px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .top { padding: 10px 16px; flex-wrap: wrap; gap: 10px; }
  .top .spacer { display: none; }
  .search { order: 5; width: 100%; }
  .funnel, .toolbar { padding-left: 16px; padding-right: 16px; }
  .board { padding: 0 16px 24px; grid-auto-columns: 82vw; }
  .f-value { font-size: 26px; }
  .toolbar .hint { display: none; }
  .wrap { padding: 20px 16px 48px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-block.wide { grid-column: auto; }
  .btn-row { grid-template-columns: 1fr; }
}
.charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.chart h3 { margin: 0 0 2px; font-size: 13.5px; font-weight: 700; }
.chart .total { color: var(--muted); font-size: 12.5px; margin-bottom: 8px; }
.chart svg { width: 100%; height: 110px; display: block; overflow: visible; }
.chart rect.b { fill: var(--ink); opacity: .85; }
.chart rect.b.accent { fill: var(--signal); opacity: 1; }
.chart g:hover rect.b { opacity: 1; fill: var(--signal); }
.chart line.base { stroke: var(--line); }
.ktable small { display: block; color: var(--muted); }
.ktable tr.click:hover td { background: var(--sunken); }
.scroll-x { overflow-x: auto; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
@media (max-width: 900px) { .charts { grid-template-columns: 1fr; } }

@media (max-width: 1400px) { .conn { font-size: 0; gap: 0; padding: 8px; } .brand > span:last-child { display: none; } }
@media (max-width: 1180px) and (min-width: 641px) { .top .search, #conn { display: none; } .top { gap: 12px; } }
@media (max-width: 900px) and (min-width: 641px) { .nav { overflow-x: auto; flex: 1; } #add-lead { font-size: 0; padding: 8px 12px; } #add-lead::before { content: '+'; font-size: 18px; line-height: 1; } }
.lang-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); flex: none; }
.lang-toggle button { border: 0; background: none; padding: 5px 9px; font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.lang-toggle button + button { border-left: 1px solid var(--line); }
.lang-toggle button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.lang-fixed { position: fixed; top: 16px; left: 16px; z-index: 20; }

/* ---------- Pipelines (un par client) ---------- */
.pipes { display: flex; gap: 6px; align-items: center; padding: 14px 24px 0; overflow-x: auto; scrollbar-width: thin; }
.ptab { display: inline-flex; align-items: center; gap: 8px; flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 7px 12px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.ptab span { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.ptab em { font-style: normal; font-weight: 500; font-size: 11.5px; color: var(--muted); }
.ptab small { font-size: 12px; color: var(--muted); font-weight: 600; }
.ptab[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.ptab.add { border-style: dashed; color: var(--muted); font-weight: 500; }
.ptab.add:hover { color: var(--signal); border-color: var(--signal); }
.pipes .grow { flex: 1; min-width: 12px; }
.pdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--muted)); margin-right: 6px; vertical-align: 1px; flex: none; }
.ptab .pdot { margin-right: 0; }
select.pipe-f { width: auto; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches label { cursor: pointer; }
.swatches input { position: absolute; opacity: 0; pointer-events: none; }
.swatches span { display: block; width: 26px; height: 26px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }
.swatches input:checked + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.swatches input:focus-visible + span { outline: 2px solid var(--signal); outline-offset: 2px; }
.checklist { display: grid; gap: 6px; max-height: 168px; overflow: auto; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--sunken); }
.autos { display: grid; gap: 6px; }
.auto { display: grid !important; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink) !important; font-size: 14px !important; cursor: pointer; }
.auto input[type=checkbox] { width: auto; margin: 3px 0 0; }
.auto > span { display: grid; gap: 2px; }
.auto:has(input[type=checkbox]:checked) { border-color: var(--signal); box-shadow: inset 0 0 0 1px var(--signal); }
@media (max-width: 720px) { .pipes { padding: 12px 16px 0; } }

/* ---------- Pipeline : vue liste ---------- */
.plist { margin: 0 24px 24px; }
.plist .clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.plist tr.unread-row td { background: var(--signal-bg); }
.plist .udot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); margin-right: 6px; vertical-align: 1px; }
.toolbar .seg button { cursor: pointer; }
.toolbar input[type=search] { padding: 5px 12px; border-radius: 999px; font-size: 13px; background: var(--surface); }
@media (max-width: 720px) { .plist { margin: 0 12px 16px; } .toolbar input[type=search] { width: 100% !important; } }
.btn.call { background: #1E9E6A; border-color: #1E9E6A; color: #fff; text-decoration: none; }
.btn.call:hover { filter: brightness(1.06); }

/* ---------- Composer : emojis et pièces jointes ---------- */
.composer .send-row { position: relative; }
.c-tools { display: flex; flex-direction: column; gap: 4px; align-self: stretch; justify-content: center; }
.c-tools .tool { width: 34px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: 16px; line-height: 1; padding: 0; }
.c-tools .tool:hover { border-color: var(--signal); }
.emoji-pop { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 30; display: grid; grid-template-columns: repeat(10, 32px); gap: 2px; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(26,35,51,.18); }
.emoji-pop button { width: 32px; height: 32px; border: 0; background: none; font-size: 20px; border-radius: 6px; cursor: pointer; padding: 0; }
.emoji-pop button:hover { background: var(--sunken); }
.file-chip { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; padding: 5px 10px; margin-bottom: 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--sunken); }
.bubble .b-media { display: block; margin: 2px 0 6px; max-width: 280px; }
.bubble .b-media img { display: block; max-width: 280px; max-height: 260px; border-radius: 8px; object-fit: cover; }
.bubble video.b-media { max-height: 220px; border-radius: 8px; }
.bubble audio.b-media { width: 260px; }
.bubble .b-file { display: flex; width: fit-content; gap: 6px; align-items: baseline; margin: 2px 0 6px; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.55); color: inherit; font-weight: 600; text-decoration: none; }
.bubble .b-file span { font-weight: 400; font-size: 12px; opacity: .7; }

.num-pick { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.num-pick select { width: auto; }
.tpl-editor .num-pick { margin-bottom: 4px; }
.num-pick + .small { display: block; margin-top: 4px; }

.pace{display:flex;gap:10px;flex-wrap:wrap;align-items:end}.pace label{display:flex;align-items:center;gap:6px;font-weight:400}.pace input{width:72px;padding:4px 8px}
