/* The Formula, DA V2 « Nuit » : console de pilotage sombre et chaude. */
:root {
  --bg: #15120f;
  --s1: #1e1a16;
  --s2: #29231d;
  --s3: #342c25;
  --line: rgba(244, 237, 219, 0.1);
  --line-2: rgba(244, 237, 219, 0.18);
  --tx: #f1e9d6;
  --tx2: #a89e8c;
  --tx3: #7d7466; /* décoratif uniquement, jamais pour du texte courant */
  --sig: #f0b429;
  --sig-hi: #f6c650;
  --sig-ink: #1a1408;
  --sig-dim: rgba(240, 180, 41, 0.13);
  --sig-line: rgba(240, 180, 41, 0.42);
  --rose: #e8a2b0;
  --rose-dim: rgba(232, 162, 176, 0.13);
  --sage: #8fbf9a;
  --sage-dim: rgba(143, 191, 154, 0.14);

  --f-head: 'Archivo', 'Inter', system-ui, sans-serif;
  --f-body: 'Inter', system-ui, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  --r: 6px;
  --r-lg: 10px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t: 160ms var(--ease);
  --side: 236px;
  --strip: 28px;
  --top: 52px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--tx);
  font: 400 14px/1.5 var(--f-body);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover, button:hover { text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--sig); color: var(--sig-ink); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--sig); outline-offset: 2px; border-radius: 4px; }
[data-lucide], svg.lucide { width: 16px; height: 16px; stroke-width: 1.75; flex: none; }
.num, .mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-feature-settings: 'zero' 0; }
.h-display { font-family: var(--f-head); font-stretch: 118%; font-weight: 700; letter-spacing: -0.02em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Bandeau maquette ---------- */
.strip {
  height: var(--strip);
  display: flex; align-items: center; justify-content: center; gap: 14px;
  font: 500 11px/1 var(--f-mono);
  letter-spacing: 0.02em;
  color: var(--tx2);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 30;
}
.strip b { color: var(--sig); font-weight: 600; }
.strip a { color: var(--tx); cursor: pointer; transition: color var(--t); }
.strip a:hover { color: var(--sig); }
.strip .sep { color: var(--tx3); }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: calc(100vh - var(--strip)); }
.sidebar {
  position: sticky; top: 0; height: calc(100vh - var(--strip));
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--bg);
  padding: 12px 10px 10px;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; }
.brand-mark { width: 22px; height: 22px; display: grid; gap: 2px; align-content: center; }
.brand-mark i { display: block; height: 4px; background: var(--sig); border-radius: 1px; }
.brand-mark i:nth-child(2) { width: 72%; opacity: 0.8; }
.brand-mark i:nth-child(3) { width: 44%; opacity: 0.6; }
.brand-name { font-family: var(--f-head); font-stretch: 125%; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand-env { margin-left: auto; font: 500 10px/1 var(--f-mono); color: var(--tx2); border: 1px solid var(--line-2); padding: 3px 5px; border-radius: 4px; }

.cmd-trigger {
  display: flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 8px 0 10px; margin: 0 0 14px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--s1); color: var(--tx2); font-size: 13px;
  transition: border-color var(--t), color var(--t), background var(--t);
}
.cmd-trigger:hover { border-color: var(--line-2); color: var(--tx); background: var(--s2); }
.cmd-trigger .kbds { margin-left: auto; }

.nav { flex: 1; overflow-y: auto; scrollbar-width: none; }
.nav-group + .nav-group { margin-top: 14px; }
.nav-label { font: 500 10.5px/1 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--tx2); padding: 0 10px 6px; }
.nav-scrim { display: none; }
.nav-item {
  position: relative; width: 100%; text-align: left;
  display: flex; align-items: center; gap: 10px;
  height: 30px; padding: 0 8px 0 10px; border-radius: var(--r);
  font-size: 13px; color: var(--tx2);
  transition: background var(--t), color var(--t);
}
.nav-item[href]:hover { color: var(--tx); background: var(--s1); }
.nav-item.is-inert { cursor: default; }
.nav-item.is-inert:hover { color: var(--tx); }
.nav-item.is-active { color: var(--tx); background: var(--s2); }
.nav-item.is-active::before { content: ''; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 2px; border-radius: 2px; background: var(--sig); }
.nav-item.is-active svg { color: var(--sig); }
.nav-item .count { margin-left: auto; font: 500 11px/1 var(--f-mono); color: var(--tx2); }
.nav-item .count.is-hot { color: var(--sig-ink); background: var(--sig); padding: 3px 5px; border-radius: 4px; }
.nav-sub { padding-left: 26px; }
.nav-sub .nav-item { height: 28px; font-size: 12.5px; }
.nav-sub .nav-item.is-active::before { left: -36px; }

.account {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; padding: 8px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--s1);
  text-align: left; width: 100%;
  transition: border-color var(--t), background var(--t);
}
.account:hover { border-color: var(--line-2); background: var(--s2); }
.avatar { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; background: var(--s3); color: var(--tx); font: 600 11px/1 var(--f-mono); flex: none; }
.avatar.is-sig { background: var(--sig); color: var(--sig-ink); }
.account-name, .account-meta { display: block; }
.account-name { font-size: 13px; font-weight: 500; line-height: 1.2; }
.account-meta { font: 400 11px/1.3 var(--f-mono); color: var(--tx2); }
.account svg { margin-left: auto; color: var(--tx2); }

.col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 15;
  height: var(--top); display: flex; align-items: center; gap: 12px;
  padding: 0 28px; border-bottom: 1px solid var(--line);
  background: rgba(21, 18, 15, 0.96);
}
.crumbs { display: flex; align-items: center; gap: 8px; font: 500 12px/1 var(--f-mono); color: var(--tx2); }
.crumbs b { color: var(--tx); font-weight: 500; }
.crumbs .slash { color: var(--tx3); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar .menu-btn { display: none; }
.agent-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 999px; font: 500 11.5px/1 var(--f-mono); color: var(--tx2);
  transition: border-color var(--t), color var(--t);
}
.agent-pill:hover { border-color: var(--line-2); color: var(--tx); }
.agent-pill b { color: var(--tx); font-weight: 500; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sig); flex: none; position: relative; }
.dot.is-live::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 1px solid var(--sig); animation: ping 2s var(--ease) infinite; }
.dot.is-off { background: var(--tx3); }
.dot.is-off::after { display: none; }
@keyframes ping { 0% { transform: scale(0.6); opacity: 0.9; } 80%, 100% { transform: scale(1.8); opacity: 0; } }

.main { padding: 28px 28px 56px; max-width: 1360px; width: 100%; }
.page-in { animation: pageIn 220ms var(--ease); }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Primitives ---------- */
.kbds { display: inline-flex; gap: 3px; }
.kbd {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px;
  font: 500 10.5px/1 var(--f-mono); color: var(--tx2);
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; background: var(--s1);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 32px; padding: 0 12px; border-radius: var(--r);
  font-size: 13px; font-weight: 500; white-space: nowrap;
  border: 1px solid var(--line-2); background: var(--s2); color: var(--tx);
  transition: background var(--t), border-color var(--t), color var(--t), transform 120ms var(--ease);
}
.btn:hover { background: var(--s3); border-color: rgba(244, 237, 219, 0.26); }
.btn:active { transform: scale(0.985); }
.btn .kbd { margin-right: -4px; }
.btn-primary { background: var(--sig); border-color: var(--sig); color: var(--sig-ink); font-weight: 600; }
.btn-primary:hover { background: var(--sig-hi); border-color: var(--sig-hi); }
.btn-primary .kbd { background: rgba(26, 20, 8, 0.08); border-color: rgba(26, 20, 8, 0.28); color: var(--sig-ink); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--tx2); }
.btn-ghost:hover { background: var(--s2); border-color: transparent; color: var(--tx); }
.btn-sm { height: 26px; padding: 0 9px; font-size: 12px; gap: 6px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.icon-btn { width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: var(--r); color: var(--tx2); transition: background var(--t), color var(--t); }
.icon-btn:hover { background: var(--s2); color: var(--tx); }

.seg { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: var(--s1); }
.seg button { height: 26px; padding: 0 10px; border-radius: 5px; font-size: 12.5px; color: var(--tx2); display: inline-flex; align-items: center; gap: 6px; transition: background var(--t), color var(--t); }
.seg button:hover { color: var(--tx); }
.seg button[aria-pressed='true'], .seg button[aria-selected='true'] { background: var(--s3); color: var(--tx); }
.seg .n { font: 500 11px/1 var(--f-mono); color: var(--tx2); }

.switch { position: relative; width: 30px; height: 18px; border-radius: 999px; background: var(--s3); border: 1px solid var(--line-2); flex: none; transition: background var(--t), border-color var(--t); }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--tx2); transition: transform 180ms var(--ease), background var(--t); }
.switch[aria-checked='true'] { background: var(--sig); border-color: var(--sig); }
.switch[aria-checked='true']::after { transform: translateX(12px); background: var(--sig-ink); }
.switch:disabled { opacity: 0.35; cursor: not-allowed; }

.tag { display: inline-flex; align-items: center; gap: 6px; height: 20px; padding: 0 7px; border-radius: 4px; font: 500 11px/1 var(--f-mono); color: var(--tx2); border: 1px solid var(--line); white-space: nowrap; }
.tag .sw { width: 6px; height: 6px; border-radius: 1px; background: currentColor; }
.st-active { color: var(--sig); border-color: var(--sig-line); }
.st-paused { color: var(--tx2); }
.st-draft { color: var(--tx2); border-style: dashed; }
.st-published { color: var(--sage); border-color: rgba(143, 191, 154, 0.4); }
.st-scheduled { color: var(--sig); border-color: var(--sig-line); }

.input {
  height: 32px; padding: 0 10px; border-radius: var(--r);
  background: var(--s1); border: 1px solid var(--line-2); width: 100%;
  font-size: 13px; transition: border-color var(--t), box-shadow var(--t);
}
.input::placeholder { color: var(--tx2); }
.input:focus { border-color: var(--sig); box-shadow: 0 0 0 3px var(--sig-dim); outline: none; }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 10px; color: var(--tx2); pointer-events: none; }
.search .input { padding-left: 32px; padding-right: 34px; }
.search .kbd { position: absolute; right: 8px; }

.eyebrow { font: 500 11px/1 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--tx2); }
.muted { color: var(--tx2); }
.up { color: var(--sage); }
.down { color: var(--rose); }

/* ---------- En-tête de page ---------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-family: var(--f-head); font-stretch: 118%; font-weight: 700; font-size: 30px; line-height: 1.1; letter-spacing: -0.025em; }
.page-head .sub { margin-top: 8px; font: 400 12.5px/1.4 var(--f-mono); color: var(--tx2); }
.page-head .sub b { color: var(--sig); font-weight: 500; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ---------- Grille modulaire à filets ---------- */
.board { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.cell { background: var(--bg); padding: 18px 20px 20px; min-width: 0; }
.cell.alt { background: var(--s1); }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; } .span-3 { grid-column: span 3; } .span-6 { grid-column: span 6; }
.cell-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; min-height: 26px; }
.cell-h h2 { margin: 0; font-family: var(--f-head); font-stretch: 112%; font-weight: 600; font-size: 14px; letter-spacing: -0.005em; }
.cell-h .meta { font: 400 11.5px/1 var(--f-mono); color: var(--tx2); }
.cell-h .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* Bande de KPI */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 16px; }
.kpi { background: var(--bg); padding: 14px 18px; }
.kpi .eyebrow { margin-bottom: 10px; }
.kpi .v { font: 600 22px/1 var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi .d { font: 400 11.5px/1 var(--f-mono); color: var(--tx2); margin-top: 8px; }

/* ---------- Aujourd'hui ---------- */
.queue { display: flex; flex-direction: column; }
.q-row { display: grid; grid-template-columns: 22px 54px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); transition: opacity 200ms var(--ease); }
.q-row:first-child { border-top: 0; padding-top: 0; }
.q-check { width: 18px; height: 18px; border-radius: 4px; border: 1px solid var(--line-2); display: grid; place-items: center; color: transparent; transition: background var(--t), border-color var(--t), color var(--t); }
.q-check:hover { border-color: var(--sig); }
.q-check svg { width: 12px; height: 12px; stroke-width: 2.5; }
.q-count { font: 600 26px/1 var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.03em; text-align: right; }
.q-row.is-first .q-count { color: var(--sig); }
.q-label { font-size: 14px; }
.q-label small { display: block; font: 400 11.5px/1.4 var(--f-mono); color: var(--tx2); margin-top: 2px; }
.q-row.is-done { opacity: 0.45; }
.q-row.is-done .q-check { background: var(--sage); border-color: var(--sage); color: var(--sig-ink); }
.q-row.is-done .q-count { color: var(--tx2); }
.q-cta { display: flex; align-items: center; gap: 8px; }
.queue-foot { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line-2); display: flex; gap: 18px; flex-wrap: wrap; font: 400 11.5px/1.4 var(--f-mono); color: var(--tx2); }
.queue-foot b { color: var(--tx); font-weight: 500; }

.agent { display: flex; flex-direction: column; gap: 16px; height: 100%; }
.agent-state { display: flex; align-items: center; gap: 10px; }
.agent-state .label { font-size: 14px; font-weight: 500; }
.agent-state .switch { margin-left: auto; }
.agent-next { padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
.agent-next .eyebrow { margin-bottom: 8px; display: flex; justify-content: space-between; }
.countdown { font: 600 30px/1 var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.countdown.is-off { color: var(--tx2); }
.agent-next .at { font: 400 12px/1.4 var(--f-mono); color: var(--tx2); margin-top: 6px; }
.gauge + .gauge { margin-top: 14px; }
.gauge-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; font-size: 12.5px; }
.gauge-h .num { font-size: 12px; color: var(--tx2); }
.gauge-h .num b { color: var(--tx); font-weight: 600; }
.segs { display: grid; grid-template-columns: repeat(20, 1fr); gap: 2px; }
.segs i { height: 10px; border-radius: 1.5px; background: var(--s3); transition: background 200ms var(--ease); }
.segs i.on { background: var(--sig); }
.agent.is-paused .segs i.on { background: var(--tx3); }
.agent-foot { margin-top: auto; display: flex; gap: 8px; font: 400 11.5px/1.4 var(--f-mono); color: var(--tx2); }

/* Entonnoir */
.funnel { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end; }
.f-col { position: relative; padding: 0 14px; border-left: 1px solid var(--line); cursor: default; transition: background var(--t); border-radius: 0; }
.f-col:first-child { border-left: 0; padding-left: 0; }
.f-col:last-child { padding-right: 0; }
.f-label { font: 500 11px/1.3 var(--f-mono); color: var(--tx2); letter-spacing: 0.02em; min-height: 30px; }
.f-val { font: 600 28px/1 var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.03em; margin-top: 4px; }
.f-delta { font: 400 11.5px/1 var(--f-mono); margin-top: 6px; }
.f-bar-wrap { position: relative; margin-top: 16px; }
.f-bar { display: flex; flex-direction: column-reverse; gap: 3px; height: 166px; }
.f-bar i { height: 4px; border-radius: 1px; background: var(--s2); transition: background 220ms var(--ease); }
.f-bar i.on { background: var(--sig); }
.f-col.is-signed .f-bar i.on { background: var(--sage); }
.f-col.is-signed .f-val { color: var(--sage); }
.f-col:hover .f-bar i.on { background: var(--sig-hi); }
.f-col.is-signed:hover .f-bar i.on { background: #a6cfb0; }
.f-rate {
  position: absolute; left: -15px; bottom: calc(var(--f) * 7px + 10px); transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 3px;
  font: 600 11px/1 var(--f-mono); color: var(--tx); background: var(--s2);
  border: 1px solid var(--line-2); border-radius: 4px; padding: 4px 6px; white-space: nowrap; z-index: 2;
}
.f-rate svg { width: 11px; height: 11px; color: var(--sig); }
.f-note { margin-top: 14px; font: 400 11px/1.4 var(--f-mono); color: var(--tx2); }

/* Semaine */
.week-tot { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 14px; }
.week-tot div { background: var(--bg); padding: 10px 12px; }
.week-tot .v { font: 600 20px/1 var(--f-mono); }
.week-tot .l { font: 400 11px/1.3 var(--f-mono); color: var(--tx2); margin-top: 6px; }
.wk-row { display: grid; grid-template-columns: 34px 1fr 26px 26px; gap: 10px; align-items: center; height: 26px; font: 400 12px/1 var(--f-mono); font-variant-numeric: tabular-nums; }
.wk-row .d { color: var(--tx2); }
.wk-row.is-today .d { color: var(--sig); font-weight: 600; }
.wk-track { height: 8px; background: var(--s2); border-radius: 2px; position: relative; overflow: hidden; }
.wk-track i { position: absolute; inset: 0 auto 0 0; background: var(--sig); border-radius: 2px; opacity: 0.85; }
.wk-row.is-today .wk-track i { opacity: 1; }
.wk-row .r { text-align: right; color: var(--rose); }
.wk-row .m { text-align: right; color: var(--sage); }
.wk-row .z { color: var(--tx3); }
.wk-legend { display: flex; gap: 14px; margin-top: 10px; font: 400 11px/1 var(--f-mono); color: var(--tx2); }
.wk-legend span { display: inline-flex; align-items: center; gap: 6px; }
.wk-legend i { width: 8px; height: 8px; border-radius: 2px; }

/* Table générique dense */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font: 500 10.5px/1 var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--tx2); padding: 0 12px 10px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.tbl th.r, .tbl td.r { text-align: right; }
.tbl td { padding: 0 12px; height: 46px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num { font-size: 12.5px; }
.tbl tbody tr { transition: background var(--t); }
.tbl tbody tr.is-click { cursor: pointer; }
.tbl tbody tr.is-click:hover { background: var(--s1); }

.hot-row td:first-child { width: 14px; padding-right: 0; }
.temp { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.temp.chaud { background: var(--rose); }
.temp.tiede { background: transparent; border: 1.5px solid var(--rose); }
.who b { display: block; font-weight: 500; font-size: 13.5px; }
.who span { font-size: 12px; color: var(--tx2); }
.quote { color: var(--tx); font-size: 13px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote::before { content: '« '; color: var(--tx2); }
.quote::after { content: ' »'; color: var(--tx2); }
.hot-row.is-replied .quote { color: var(--tx2); }
.is-flash { animation: flash 1.2s var(--ease); }
@keyframes flash { 0%, 40% { background: var(--sig-dim); } 100% { background: transparent; } }
.reply-row td { padding: 0 12px 14px; height: auto; }
.reply-box { display: flex; gap: 8px; align-items: flex-start; padding: 10px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--s1); animation: drop 200ms var(--ease); }
.reply-box textarea { flex: 1; min-height: 56px; resize: vertical; background: transparent; border: 0; font-size: 13px; line-height: 1.5; outline: none; }
.reply-box textarea::placeholder { color: var(--tx2); }
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Campagnes ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .search { width: 280px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 12px; color: var(--tx2); transition: border-color var(--t), color var(--t), background var(--t); display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { color: var(--tx); border-color: var(--line-2); }
.chip[aria-pressed='true'] { color: var(--tx); border-color: var(--sig-line); background: var(--sig-dim); }
.chip .n { font: 500 10.5px/1 var(--f-mono); color: var(--tx2); }

.list-frame { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.list-frame .tbl th { padding-top: 12px; background: var(--s1); }
.camp-row { position: relative; }
.camp-row td:first-child { width: 52px; padding-left: 16px; }
.camp-row.is-sel { background: var(--s1); }
.camp-row.is-sel td:first-child { box-shadow: inset 2px 0 0 var(--sig); }
.camp-row.is-paused .c-name, .camp-row.is-draft .c-name { color: var(--tx2); }
.c-name { font-weight: 500; font-size: 13.5px; display: block; }
.c-meta { display: flex; gap: 8px; align-items: center; margin-top: 3px; font: 400 11.5px/1 var(--f-mono); color: var(--tx2); }
.rate { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.rate .bar { width: 44px; height: 4px; background: var(--s3); border-radius: 2px; overflow: hidden; }
.rate .bar i { display: block; height: 100%; background: var(--sig); }
.nil { color: var(--tx3); }
.list-foot { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--s1); font: 400 11.5px/1 var(--f-mono); color: var(--tx2); flex-wrap: wrap; }
.list-foot span { display: inline-flex; align-items: center; gap: 6px; }
.list-foot .right { margin-left: auto; }
.empty { padding: 48px 16px; text-align: center; color: var(--tx2); }
.empty b { display: block; color: var(--tx); font-family: var(--f-head); font-stretch: 112%; font-weight: 600; margin-bottom: 6px; font-size: 15px; }

/* Panneau latéral */
.scrim { position: fixed; inset: 0; background: rgba(10, 8, 6, 0.56); z-index: 40; animation: fade 180ms var(--ease); }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); z-index: 41;
  background: var(--s1); border-left: 1px solid var(--line-2);
  display: flex; flex-direction: column;
  animation: slideIn 220ms var(--ease);
}
.panel.is-leaving { animation: slideOut 160ms var(--ease) forwards; }
.scrim.is-leaving { animation: fadeOut 160ms var(--ease) forwards; }
@keyframes slideIn { from { transform: translateX(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideOut { to { transform: translateX(12px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }
.panel-h { display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 12px 0 20px; border-bottom: 1px solid var(--line); }
.panel-h .crumbs { font-size: 11.5px; }
.panel-h .right { margin-left: auto; display: flex; gap: 2px; align-items: center; }
.panel-b { flex: 1; overflow-y: auto; padding: 20px; }
.panel-b h2 { margin: 0 0 8px; font-family: var(--f-head); font-stretch: 115%; font-weight: 700; font-size: 21px; letter-spacing: -0.02em; line-height: 1.2; }
.panel-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.panel-swap { animation: swap 180ms var(--ease); }
@keyframes swap { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.mini-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 20px; }
.mini-kpis div { background: var(--bg); padding: 12px 14px; }
.mini-kpis .v { font: 600 20px/1 var(--f-mono); }
.mini-kpis .l { font: 400 11px/1.3 var(--f-mono); color: var(--tx2); margin-top: 6px; }
.section-t { font: 500 10.5px/1 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--tx2); margin: 0 0 10px; }
.hbars { margin-bottom: 22px; }
.hbar { display: grid; grid-template-columns: 96px 1fr 52px; gap: 10px; align-items: center; height: 26px; font-size: 12.5px; }
.hbar .l { color: var(--tx2); }
.hbar .t { height: 8px; background: var(--s3); border-radius: 2px; overflow: hidden; }
.hbar .t i { display: block; height: 100%; background: var(--sig); border-radius: 2px; transition: width 300ms var(--ease); }
.hbar.is-m .t i { background: var(--sage); }
.hbar .v { text-align: right; font: 500 12px/1 var(--f-mono); }
.steps { list-style: none; margin: 0 0 22px; padding: 0; counter-reset: s; }
.steps li { position: relative; display: flex; gap: 12px; align-items: center; padding: 8px 0; font-size: 13px; }
.steps li::before { counter-increment: s; content: counter(s, decimal-leading-zero); font: 500 11px/1 var(--f-mono); color: var(--tx2); width: 26px; height: 22px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 4px; background: var(--bg); flex: none; }
.steps li + li::after { content: ''; position: absolute; left: 13px; top: -6px; height: 12px; width: 1px; background: var(--line-2); }
.panel-f { display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
.panel-f .btn:last-child { margin-left: auto; }

/* ---------- Modales et palette ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 50; display: grid; place-items: start center; padding: 9vh 16px 16px; overflow-y: auto; }
.modal-wrap .scrim { z-index: 0; }
.modal {
  position: relative; z-index: 1; width: min(560px, 100%);
  background: var(--s1); border: 1px solid var(--line-2); border-radius: 12px;
  animation: pop 200ms var(--ease);
}
.modal.is-wide { width: min(980px, 100%); }
.modal-wrap.is-leaving .modal { animation: popOut 150ms var(--ease) forwards; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes popOut { to { opacity: 0; transform: translateY(6px) scale(0.985); } }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 20px; border-bottom: 1px solid var(--line); }
.modal-h h2 { margin: 0; font-family: var(--f-head); font-stretch: 115%; font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.modal-h .icon-btn { margin-left: auto; }
.modal-b { padding: 20px; }
.modal-f { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-f .spacer { flex: 1; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font: 500 11px/1 var(--f-mono); color: var(--tx2); letter-spacing: 0.04em; margin-bottom: 8px; text-transform: uppercase; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt { text-align: left; padding: 12px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg); transition: border-color var(--t), background var(--t); }
.opt:hover { border-color: rgba(244, 237, 219, 0.3); }
.opt[aria-checked='true'] { border-color: var(--sig); background: var(--sig-dim); }
.opt b { display: block; font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.opt small { font-size: 12px; color: var(--tx2); line-height: 1.4; display: block; }

.palette { width: min(620px, 100%); }
.palette-in { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 54px; border-bottom: 1px solid var(--line); }
.palette-in svg { color: var(--tx2); }
.palette-in input { flex: 1; height: 100%; background: transparent; border: 0; font-size: 15px; outline: none; }
.palette-in input::placeholder { color: var(--tx2); }
.palette-list { max-height: 360px; overflow-y: auto; padding: 6px; }
.p-group { font: 500 10.5px/1 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--tx2); padding: 12px 10px 6px; }
.p-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px; border-radius: var(--r); font-size: 13.5px; text-align: left; color: var(--tx); }
.p-item svg { color: var(--tx2); }
.p-item .hint { margin-left: auto; font: 400 11.5px/1 var(--f-mono); color: var(--tx2); display: flex; gap: 8px; align-items: center; }
.p-item.is-on { background: var(--s3); }
.p-item.is-on svg { color: var(--sig); }
.p-empty { padding: 28px; text-align: center; color: var(--tx2); font-size: 13px; }
.palette-f { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font: 400 11px/1 var(--f-mono); color: var(--tx2); }
.palette-f span { display: inline-flex; gap: 6px; align-items: center; }
.sc-list { display: grid; grid-template-columns: 1fr auto; gap: 10px 24px; font-size: 13px; align-items: center; }
.sc-list dt { color: var(--tx2); }
.sc-list dd { margin: 0; justify-self: end; }
.sc-list h3 { grid-column: 1 / -1; margin: 8px 0 0; font: 500 10.5px/1 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--tx2); }

/* Toast */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: var(--r); background: var(--s2); border: 1px solid var(--line-2); font-size: 13px; animation: toastIn 200ms var(--ease); max-width: 360px; }
.toast svg { color: var(--sig); }
.toast.is-leaving { animation: fadeOut 180ms var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Mes posts ---------- */
.subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.subtab { position: relative; height: 38px; padding: 0 12px; font-size: 13px; color: var(--tx2); display: inline-flex; align-items: center; gap: 8px; transition: color var(--t); }
.subtab:hover { color: var(--tx); }
.subtab[aria-selected='true'] { color: var(--tx); }
.subtab[aria-selected='true']::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--sig); border-radius: 2px; }
.subtab[aria-disabled='true'] { cursor: default; }
.post-hook { font-size: 13px; line-height: 1.45; max-width: 520px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-row td { height: 60px; }
.post-row .when { font: 400 12px/1.35 var(--f-mono); color: var(--tx2); white-space: nowrap; }
.post-row .when b { color: var(--tx); font-weight: 500; }
.fmt { font: 400 11.5px/1 var(--f-mono); color: var(--tx2); }

.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 248px; gap: 16px; align-items: start; }
.cal { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.cal-nav { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--s1); }
.cal-nav .t { font: 500 12.5px/1 var(--f-mono); }
.cal-nav .right { margin-left: auto; display: flex; gap: 6px; }
.cal-grid { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); position: relative; }
.cal-dh { padding: 10px 8px; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); font: 500 11px/1.2 var(--f-mono); color: var(--tx2); }
.cal-dh b { display: block; font: 600 17px/1.1 var(--f-mono); color: var(--tx); margin-top: 3px; }
.cal-dh.is-today { color: var(--sig); }
.cal-dh.is-today b { color: var(--sig); }
.cal-lane-l, .cal-h { font: 400 10.5px/1 var(--f-mono); color: var(--tx2); padding: 6px 8px 0 0; text-align: right; }
.cal-lane { min-height: 40px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line-2); padding: 4px; display: flex; flex-direction: column; gap: 4px; }
.cal-slot { height: 44px; border-left: 1px solid var(--line); border-top: 1px solid var(--line); position: relative; transition: background var(--t); cursor: pointer; }
.cal-slot:hover { background: var(--s1); }
.cal-slot:hover::after { content: '+'; position: absolute; right: 6px; top: 4px; font: 500 12px/1 var(--f-mono); color: var(--tx2); }
.cal-slot.is-past { cursor: default; background: rgba(244, 237, 219, 0.015); }
.cal-slot.is-past:hover { background: rgba(244, 237, 219, 0.015); }
.cal-slot.is-past:hover::after { display: none; }
.ev {
  position: absolute; left: 3px; right: 3px; top: 2px; z-index: 2;
  padding: 6px 7px; border-radius: 4px; text-align: left;
  background: var(--sig-dim); border-left: 2px solid var(--sig);
  font-size: 11.5px; line-height: 1.35; color: var(--tx); overflow: hidden;
  transition: background var(--t), transform 140ms var(--ease);
}
.ev:hover { background: rgba(240, 180, 41, 0.22); transform: translateY(-1px); }
.ev .tm { display: block; font: 600 10.5px/1 var(--f-mono); color: var(--sig); margin-bottom: 3px; }
.ev .tx { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ev.is-pub { position: static; background: var(--sage-dim); border-left-color: var(--sage); }
.ev.is-pub .tm { color: var(--sage); }
.ev.is-pub:hover { background: rgba(143, 191, 154, 0.22); }
.now-line { position: absolute; height: 0; border-top: 1px solid var(--rose); z-index: 3; pointer-events: none; }
.now-line::before { content: ''; position: absolute; left: -4px; top: -4px; width: 7px; height: 7px; border-radius: 50%; background: var(--rose); }
.drafts { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; background: var(--s1); }
.draft-card { display: block; width: 100%; text-align: left; padding: 10px; border: 1px dashed var(--line-2); border-radius: var(--r); font-size: 12.5px; line-height: 1.45; margin-top: 8px; transition: border-color var(--t), background var(--t), transform 140ms var(--ease); }
.draft-card:hover { border-color: var(--sig-line); background: var(--s2); transform: translateY(-1px); }
.draft-card .fmt { display: block; margin-top: 6px; }

/* Éditeur */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 400px; }
.editor-l { padding: 20px; border-right: 1px solid var(--line); min-width: 0; }
.editor-r { padding: 20px; background: var(--bg); min-width: 0; border-radius: 0 0 12px 0; }
.editor textarea.compose { width: 100%; min-height: 260px; resize: vertical; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--bg); font-size: 14px; line-height: 1.6; transition: border-color var(--t), box-shadow var(--t); }
.editor textarea.compose:focus { border-color: var(--sig); box-shadow: 0 0 0 3px var(--sig-dim); outline: none; }
.counter { display: flex; align-items: center; gap: 12px; margin-top: 8px; font: 400 11.5px/1 var(--f-mono); color: var(--tx2); }
.counter .bar { flex: 1; height: 3px; background: var(--s3); border-radius: 2px; overflow: hidden; }
.counter .bar i { display: block; height: 100%; background: var(--sig); transition: width 120ms linear, background var(--t); }
.counter.is-warn .bar i { background: var(--rose); }
.counter.is-warn b { color: var(--rose); }
.counter b { color: var(--tx); font-weight: 600; }
.hook-meter { margin-top: 6px; font: 400 11.5px/1.4 var(--f-mono); color: var(--tx2); }
.hook-meter b { color: var(--sig); font-weight: 500; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 16px; }
.row-2 .field { margin: 0; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--tx2) 50%), linear-gradient(135deg, var(--tx2) 50%, transparent 50%); background-position: calc(100% - 14px) 14px, calc(100% - 10px) 14px; background-size: 4px 4px; background-repeat: no-repeat; padding-right: 26px; }
.li-card { background: #f4eddb; color: #1d1712; border-radius: 8px; overflow: hidden; margin: 0 auto; transition: max-width 220ms var(--ease); max-width: 360px; }
.li-card.is-mobile { max-width: 300px; }
.li-head { display: flex; gap: 10px; padding: 12px 14px 8px; align-items: center; }
.li-head .avatar { border-radius: 50%; width: 40px; height: 40px; background: #241a15; color: #f0b429; font-size: 13px; }
.li-head b { display: block; font-size: 13px; }
.li-head span { display: block; font-size: 11.5px; color: #5e5242; line-height: 1.35; }
.li-body { padding: 0 14px 12px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.li-body .more { color: #5e5242; font-weight: 600; cursor: pointer; }
.li-body .more:hover { color: #1d1712; }
.li-body .ph { color: #6a5e4c; }
.li-media { margin: 0 14px 12px; height: 120px; border-radius: 4px; background: repeating-linear-gradient(135deg, #e6dcc2 0 10px, #ebe1c8 10px 20px); display: grid; place-items: center; font: 500 11px/1 var(--f-mono); color: #5e5242; }
.li-stats { display: flex; justify-content: space-between; padding: 8px 14px; border-top: 1px solid rgba(29, 23, 18, 0.12); font-size: 11.5px; color: #5e5242; }
.li-acts { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid rgba(29, 23, 18, 0.12); }
.li-acts span { display: flex; align-items: center; justify-content: center; gap: 5px; height: 36px; font-size: 11.5px; color: #4e4334; font-weight: 600; }
.li-acts svg { width: 14px; height: 14px; }
.preview-h { display: flex; align-items: center; margin-bottom: 14px; }
.preview-h .seg { margin-left: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .span-8, .span-7 { grid-column: span 12; }
  .span-4, .span-5 { grid-column: span 6; }
  .hide-lg { display: none; }
}
@media (max-width: 1100px) {
  :root { --side: 208px; }
  .main { padding: 24px 20px 48px; }
  .topbar { padding: 0 20px; }
  .editor { grid-template-columns: 1fr; }
  .editor-l { border-right: 0; border-bottom: 1px solid var(--line); }
  .editor-r { border-radius: 0 0 12px 12px; }
  .cal-wrap { grid-template-columns: 1fr; }
  .hide-md { display: none; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; width: 264px; transform: translateX(-100%); transition: transform 220ms var(--ease); z-index: 45; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .nav-scrim { display: block; }
  .nav-scrim { display: none; position: fixed; inset: 0; background: rgba(10, 8, 6, 0.6); z-index: 44; }
  .topbar .menu-btn { display: inline-grid; margin-left: -6px; }
  .btn .kbd, .btn .kbds, .cell-h .right.meta { display: none; }
  .strip { white-space: nowrap; }
  .topbar { padding: 0 14px; }
  .topbar .agent-pill .hide-sm { display: none; }
  .main { padding: 18px 14px 40px; }
  .page-head h1 { font-size: 25px; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .span-4, .span-5, .span-6, .span-3 { grid-column: span 12; }
  .cell { padding: 16px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .hide-sm { display: none !important; }
  .q-row { grid-template-columns: 20px 40px minmax(0, 1fr); row-gap: 8px; }
  .q-count { font-size: 22px; }
  .q-cta { grid-column: 3; }
  .funnel { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .f-col { padding: 0 6px; }
  .f-val { font-size: 17px; }
  .f-label { font-size: 9.5px; min-height: 38px; }
  .f-bar { height: 120px; gap: 2px; }
  .f-bar i { height: 3px; }
  .f-rate { left: -7px; bottom: calc(var(--f) * 5px + 6px); font-size: 9.5px; padding: 3px 4px; }
  .f-rate svg { display: none; }
  .f-delta { font-size: 10px; }
  .toolbar .search { width: 100%; }
  .tbl td, .tbl th { padding-left: 8px; padding-right: 8px; }
  .quote { max-width: 180px; }
  .opts { grid-template-columns: 1fr; }
  .row-2 { grid-template-columns: 1fr; }
  .strip { font-size: 10px; gap: 8px; }
  .strip .hide-sm { display: none; }
  .cal { overflow-x: auto; }
  .cal-grid { min-width: 640px; }
}

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