/* ================================================================== */
/* Tokens                                                             */
/* ================================================================== */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --surface-3: #e8ebf0;
  --border: #e2e6ec;
  --border-strong: #cdd4de;
  --text: #14171c;
  --muted: #6b7480;
  --faint: #9aa3ae;
  --accent: #2f6fed;
  --accent-soft: #e7effd;
  --green: #0e8a56;
  --green-soft: #dcf5e9;
  --red: #cf3230;
  --red-soft: #fde7e6;
  --amber: #9a6200;
  --amber-soft: #fdf1d8;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 6px 16px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 48px rgba(16, 24, 40, 0.18);
  --r: 10px;
  --sidebar-w: 232px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0f14;
    --surface: #151a21;
    --surface-2: #1b212a;
    --surface-3: #232b36;
    --border: #262e39;
    --border-strong: #38424f;
    --text: #e6edf3;
    --muted: #8b949e;
    --faint: #6e7681;
    --accent: #5b8cff;
    --accent-soft: #17233d;
    --green: #3fcb8e;
    --green-soft: #0f2a1f;
    --red: #ff7b74;
    --red-soft: #2c1614;
    --amber: #e3b341;
    --amber-soft: #2a2113;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 6px 18px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

a { color: inherit; text-decoration: none; }
input, select, textarea, button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
::placeholder { color: var(--faint); }

/* ================================================================== */
/* Boutons / champs                                                   */
/* ================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.09); background: var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--red); }
.btn-sm { padding: 3px 9px; font-size: 12.5px; border-radius: 6px; }
.btn-block { width: 100%; justify-content: center; padding: 9px; }

input[type="text"], input[type="password"], input[type="email"], input[type="tel"],
input[type="number"], input[type="date"], input[type="search"], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 76px; font-family: inherit; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

kbd {
  font: 10.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 3px 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
}

/* ================================================================== */
/* Connexion                                                          */
/* ================================================================== */
.login { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card {
  width: 100%; max-width: 340px; text-align: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px 26px; box-shadow: var(--shadow);
}
.login-logo { font-size: 40px; }
.login-card h1 { margin: 6px 0 2px; font-size: 22px; }
.login-card p { margin: 0 0 20px; font-size: 14px; }
.login-card input { margin-bottom: 12px; text-align: center; }
.login-error { color: var(--red); font-size: 13px; margin-top: 12px !important; }

/* ================================================================== */
/* Structure                                                          */
/* ================================================================== */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 10px 10px;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 8px; padding: 2px 8px 12px; }
.sidebar-brand .logo { font-size: 18px; }
.sidebar-brand .name { font-weight: 700; letter-spacing: -0.01em; }

.side-search {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 7px 10px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--muted);
  cursor: pointer; font-size: 13px;
}
.side-search:hover { border-color: var(--border-strong); }

.side-nav { display: flex; flex-direction: column; gap: 1px; }
.side-nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 7px;
  color: var(--muted); font-weight: 500;
}
.side-nav a .ico { font-size: 14px; width: 17px; text-align: center; }
.side-nav a:hover { background: var(--surface-3); color: var(--text); }
.side-nav a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 600; }

.side-section { margin-top: 18px; }
.side-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 10px 5px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint);
}
.side-add {
  border: none; background: none; cursor: pointer; color: var(--faint);
  font-size: 16px; line-height: 1; padding: 0 3px; border-radius: 4px;
}
.side-add:hover { background: var(--surface-3); color: var(--text); }

.side-projects { display: flex; flex-direction: column; gap: 1px; }
.side-projects a {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 7px; color: var(--muted); font-size: 13.5px;
}
.side-projects a:hover { background: var(--surface-3); color: var(--text); }
.side-projects a.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }
.side-projects .pname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-projects .pcount { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.sidebar-foot { margin-top: auto; padding-top: 12px; }

.swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; background: var(--faint); }

.content { flex: 1; min-width: 0; }
main { padding: 22px 24px 90px; max-width: 1500px; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.page-head h1 { font-size: 21px; margin: 0; letter-spacing: -0.02em; }
.page-head .sub { color: var(--muted); font-size: 13px; font-weight: 400; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ================================================================== */
/* Cartes de statistiques                                             */
/* ================================================================== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 10px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; }
.stat .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat .v { font-size: 20px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 1px; }
.stat.alert .v { color: var(--red); }
.stat.good .v { color: var(--green); }
.stat.accent .v { color: var(--accent); }

.section { margin-bottom: 26px; }
.section > h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted);
  margin: 0 0 10px; display: flex; align-items: center; gap: 8px;
}
.section > h2 .count { background: var(--surface-3); border-radius: 20px; padding: 1px 8px; font-size: 11px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.empty {
  padding: 26px 16px; text-align: center; color: var(--muted); font-size: 13.5px;
  border: 1px dashed var(--border-strong); border-radius: var(--r);
}

.list { display: flex; flex-direction: column; }
.list > * + * { border-top: 1px solid var(--border); }

/* ================================================================== */
/* Pastilles                                                          */
/* ================================================================== */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: var(--surface-3); color: var(--muted); white-space: nowrap;
}
.pill.late { background: var(--red-soft); color: var(--red); }
.pill.today { background: var(--amber-soft); color: var(--amber); }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill-project { background: color-mix(in srgb, var(--pc) 16%, transparent); color: var(--pc); }
@media (prefers-color-scheme: dark) { .pill-project { background: color-mix(in srgb, var(--pc) 22%, transparent); } }

/* ================================================================== */
/* Relances                                                           */
/* ================================================================== */
.task-row { display: flex; align-items: flex-start; gap: 11px; padding: 10px 14px; }
.task-row:hover { background: var(--surface-2); }
.check {
  flex: none; width: 19px; height: 19px; margin-top: 2px; padding: 0;
  border: 1.5px solid var(--border-strong); border-radius: 50%;
  background: transparent; cursor: pointer; display: grid; place-items: center;
  font-size: 11px; color: transparent;
}
.check:hover { border-color: var(--green); color: var(--green); }
.check.done { background: var(--green); border-color: var(--green); color: #fff; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 500; }
.task-title.done { text-decoration: line-through; color: var(--muted); }
.task-meta { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 9px; margin-top: 2px; align-items: center; }
.task-actions { display: flex; gap: 4px; flex: none; opacity: 0; transition: opacity 0.12s; }
.task-row:hover .task-actions, .task-row:focus-within .task-actions { opacity: 1; }
@media (hover: none) { .task-actions { opacity: 1; } }

/* ================================================================== */
/* Kanban                                                             */
/* ================================================================== */
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(262px, 1fr);
  gap: 12px; overflow-x: auto; padding-bottom: 12px; scroll-snap-type: x proximity;
}
.col {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r);
  padding: 10px; min-height: 200px; scroll-snap-align: start;
  outline: 2px solid transparent; outline-offset: -2px;
  transition: background 0.12s, outline-color 0.12s;
}
.col.dragover { outline-color: var(--accent); background: var(--accent-soft); }
.col-won { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 28%, transparent); }
.col-won.dragover { outline-color: var(--green); }
.col-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 2px 2px; }
.col-head .name { font-weight: 650; font-size: 13.5px; }
.col-head .sum { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.col-note { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint); padding: 2px 2px 0; }
.col-cards { display: flex; flex-direction: column; gap: 8px; min-height: 40px; margin-top: 9px; }

.deal {
  position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--pc, var(--border-strong));
  border-radius: 9px; padding: 9px 11px; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.06s;
}
.deal:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.deal.dragging { opacity: 0.35; }
.deal .t { font-weight: 600; line-height: 1.3; }
.deal .c { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.deal .b { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.deal .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.deal .comm { font-size: 11.5px; color: var(--green); font-weight: 600; font-variant-numeric: tabular-nums; }
.deal-flags { display: flex; gap: 5px; align-items: center; font-size: 12px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.red { background: var(--red); }
.dot.amber { background: var(--amber); }
.advance {
  border: none; background: var(--surface-3); border-radius: 6px;
  padding: 2px 7px; cursor: pointer; color: var(--muted); font-size: 13px;
}
.advance:hover { background: var(--accent); color: #fff; }
.advance.win { background: var(--green-soft); }
.advance.win:hover { background: var(--green); }
.deal.won { border-left-color: var(--green); }
.deal.won .v { color: var(--green); }

/* ================================================================== */
/* Tableau façon Monday                                               */
/* ================================================================== */
.tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 900px; }
table.grid th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 600; padding: 9px 12px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
  position: sticky; top: 0; z-index: 2;
}
table.grid th.right, table.grid td.right { text-align: right; }
table.grid td { padding: 0; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: none; }
table.grid tbody tr:hover { background: var(--surface-2); }

.grp-row td {
  background: color-mix(in srgb, var(--pc, var(--muted)) 10%, var(--surface));
  border-bottom: 1px solid var(--border);
  padding: 7px 12px;
  font-weight: 700; font-size: 12.5px;
}
@media (prefers-color-scheme: dark) {
  .grp-row td { background: color-mix(in srgb, var(--pc, var(--muted)) 16%, var(--surface)); }
}
.grp-row .gname { display: inline-flex; align-items: center; gap: 8px; color: var(--pc, var(--text)); }
.grp-row .gmeta { float: right; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.grp-toggle { border: none; background: none; cursor: pointer; color: inherit; padding: 0 2px; font-size: 11px; }

.cell { padding: 8px 12px; cursor: text; min-height: 36px; display: block; }
.cell:hover { box-shadow: inset 0 0 0 1px var(--border-strong); border-radius: 5px; }
.cell.num { font-variant-numeric: tabular-nums; }
.cell-static { padding: 8px 12px; }
.cell input, .cell select {
  width: 100%; padding: 4px 6px; border-radius: 5px;
  border: 1px solid var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.cell-empty { color: var(--faint); }

.stage-select {
  appearance: none; border: none; cursor: pointer;
  padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700;
  background: var(--surface-3); color: var(--muted); text-align: center;
}
.stage-select:focus { box-shadow: 0 0 0 3px var(--accent-soft); }
.stage-leads { background: var(--surface-3); color: var(--muted); }
.stage-doc { background: var(--accent-soft); color: var(--accent); }
.stage-chaud { background: var(--amber-soft); color: var(--amber); }
.stage-closed, .stage-won { background: var(--green-soft); color: var(--green); }
.stage-lost { background: var(--red-soft); color: var(--red); }

.split-toggle {
  border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer;
  padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700; color: var(--muted);
}
.split-toggle.on { background: var(--amber-soft); border-color: transparent; color: var(--amber); }
.commission { color: var(--green); font-weight: 700; }

/* ================================================================== */
/* Projets                                                            */
/* ================================================================== */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 12px; }
.project-card {
  background: var(--surface); border: 1px solid var(--border);
  border-top: 3px solid var(--pc); border-radius: var(--r);
  padding: 14px 15px; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: box-shadow 0.12s, transform 0.06s;
}
.project-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.project-card h3 { margin: 0 0 2px; font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.project-card .rate { font-size: 12.5px; color: var(--muted); }
.project-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 13px; }
.project-stats .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--faint); }
.project-stats .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.project-stats .v.green { color: var(--green); }

/* ================================================================== */
/* Contacts                                                           */
/* ================================================================== */
.toolbar { display: flex; gap: 9px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar input[type="search"] { flex: 1; min-width: 190px; }
.toolbar select { width: auto; }

.contact-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; }
.contact-row:hover { background: var(--surface-2); }
.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 12.5px;
}
.contact-main { flex: 1; min-width: 0; }
.contact-main .n { font-weight: 600; }
.contact-main .m { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-side { text-align: right; font-size: 12.5px; color: var(--muted); flex: none; }
.contact-side .v { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---- Liste de prospection (Leads) ---- */
.lead-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 14px; }
.lead-tab {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 5px 12px; font-size: 12.5px; color: var(--muted);
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: all .12s;
}
.lead-tab:hover { border-color: var(--border-strong); color: var(--text); }
.lead-tab.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.lead-tab-n {
  font-size: 11px; font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, currentColor 16%, transparent); border-radius: 999px; padding: 0 6px;
}
.lead-tab.on .lead-tab-n { background: rgba(255,255,255,.25); }

.lead-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px 11px 12px; cursor: pointer; position: relative; }
.lead-row:hover { background: var(--surface-2); }
.lead-bar { flex: none; width: 3px; align-self: stretch; border-radius: 3px; margin: 2px 2px 2px 0; }
.lead-main { flex: 1; min-width: 0; }
.lead-top { display: flex; align-items: center; gap: 8px; }
.lead-top .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-pill {
  flex: none; font-size: 11px; font-weight: 600; line-height: 1.6;
  padding: 0 8px; border-radius: 999px;
  color: var(--pc); background: color-mix(in srgb, var(--pc) 15%, transparent);
}
.lead-main .m { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-note { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.lead-side { text-align: right; flex: none; }
.lead-side .v { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.lead-sub { font-size: 12px; color: var(--muted); }

/* ================================================================== */
/* Panneau latéral glissant                                           */
/* ================================================================== */
.drawer-scrim {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(10, 12, 16, 0.35);
  animation: fade 0.15s ease-out;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 91;
  width: min(460px, 100vw);
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg); overflow-y: auto;
  animation: slidein 0.18s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes slidein { from { transform: translateX(100%); } }
@keyframes fade { from { opacity: 0; } }

.drawer-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 16px 18px 12px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.drawer-head h2 { margin: 0; font-size: 18px; letter-spacing: -0.01em; line-height: 1.3; }
.drawer-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.drawer-close {
  margin-left: auto; flex: none; border: none; background: var(--surface-2);
  width: 28px; height: 28px; border-radius: 7px; cursor: pointer; color: var(--muted); font-size: 15px;
}
.drawer-close:hover { background: var(--surface-3); color: var(--text); }
.drawer-body { padding: 16px 18px 40px; }

.props { display: grid; grid-template-columns: 108px 1fr; gap: 2px 10px; align-items: center; }
.props dt { font-size: 12.5px; color: var(--muted); }
.props dd { margin: 0; min-width: 0; }
.props dd .cell { padding: 5px 7px; margin-left: -7px; border-radius: 6px; }

.drawer .quick-actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0; }
.drawer h3 {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); margin: 22px 0 8px;
}

.timeline { padding: 2px 0; }
.tl-item { display: flex; gap: 10px; padding: 8px 0; }
.tl-icon {
  flex: none; width: 25px; height: 25px; border-radius: 50%;
  background: var(--surface-2); display: grid; place-items: center; font-size: 12px;
}
.tl-body { flex: 1; min-width: 0; }
.tl-body .txt { white-space: pre-wrap; word-break: break-word; font-size: 13.5px; }
.tl-body .when { font-size: 11.5px; color: var(--faint); }

/* ================================================================== */
/* Overlays                                                           */
/* ================================================================== */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 12, 16, 0.45); backdrop-filter: blur(2px);
  display: flex; justify-content: center; padding: 20px; overflow-y: auto;
}
.palette-box {
  width: 100%; max-width: 560px; margin-top: 10vh; align-self: flex-start; height: fit-content;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.palette-box > input { border: none; border-bottom: 1px solid var(--border); border-radius: 0; padding: 15px 18px; font-size: 16px; }
.palette-box > input:focus { box-shadow: none; }
.palette-results { max-height: 55vh; overflow-y: auto; }
.palette-results .grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint); padding: 9px 18px 4px; }
.palette-results .res { padding: 9px 18px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.palette-results .res.sel { background: var(--accent-soft); }
.palette-results .res .sub { color: var(--muted); font-size: 12.5px; }

.modal-box {
  width: 100%; max-width: 540px; margin: auto; height: fit-content;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 22px;
}
.modal-box h2 { margin: 0 0 16px; font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.modal-actions .spacer { flex: 1; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 11px; border: 1px solid var(--border-strong); border-radius: 20px;
  background: var(--surface); cursor: pointer; font-size: 13px;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.color-grid { display: flex; gap: 7px; flex-wrap: wrap; }
.color-dot {
  width: 26px; height: 26px; border-radius: 8px; cursor: pointer;
  border: 2px solid transparent; padding: 0;
}
.color-dot.on { border-color: var(--text); }

/* ================================================================== */
/* Notifications                                                      */
/* ================================================================== */
.toasts {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  background: var(--text); color: var(--bg);
  padding: 8px 16px; border-radius: 20px; font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow); animation: pop 0.18s ease-out;
}
.toast.err { background: var(--red); color: #fff; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

/* ================================================================== */
/* Mobile                                                             */
/* ================================================================== */
.mobilenav { display: none; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  main { padding: 16px 13px 92px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .board { grid-auto-columns: 84vw; }
  .drawer { width: 100vw; border-left: none; }
  .props { grid-template-columns: 96px 1fr; }

  .mobilenav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(12px); border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mobilenav a, .mobilenav button {
    flex: 1; border: none; background: none; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 7px 0 6px; font-size: 10.5px; color: var(--muted);
  }
  .mobilenav span { font-size: 18px; }
  .mobilenav a.active { color: var(--accent); }
}

/* ================================================================== */
/* Cockpit                                                            */
/* ================================================================== */
.cockpit-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.cockpit-head h1 { margin: 0; font-size: 25px; letter-spacing: -0.025em; font-weight: 680; }
.cockpit-head p { margin: 2px 0 0; font-size: 13.5px; text-transform: capitalize; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)); gap: 11px; margin-bottom: 26px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: 13px;
  padding: 14px 16px; transition: border-color 0.14s, box-shadow 0.14s;
}
.kpi .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.kpi .v { font-size: 23px; font-weight: 700; margin-top: 5px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 3px; }
.kpi .s.link { color: var(--accent); font-weight: 600; }
.kpi.alert .v { color: var(--red); }
.kpi.good .v { color: var(--green); }
.kpi-goal { cursor: pointer; }
.kpi-goal:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.kpi .bar { height: 5px; border-radius: 3px; background: var(--surface-3); margin: 9px 0 5px; overflow: hidden; }
.kpi .bar span { display: block; height: 100%; border-radius: 3px; background: var(--green); transition: width 0.4s cubic-bezier(0.4,0,0.2,1); }
.kpis-sm { grid-template-columns: 1fr 1fr; margin-bottom: 18px; }
.kpis-sm .v { font-size: 18px; }

/* --- File d'action prioritaire ------------------------------------ */
.focus { margin-bottom: 26px; }
.focus-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.focus-head h2 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.focus-head .count {
  background: var(--accent); color: #fff; border-radius: 20px;
  padding: 1px 9px; font-size: 11.5px; font-weight: 700;
}
.focus-head .spacer { flex: 1; }
.focus-head .muted { font-size: 12.5px; }

.focus-list {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 13px; overflow: hidden; box-shadow: var(--shadow-sm);
}
.focus-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 15px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.1s;
}
.focus-row:last-child { border-bottom: none; }
.focus-row:hover { background: var(--surface-2); }
.focus-row.late { box-shadow: inset 3px 0 0 var(--red); }
.focus-ico { flex: none; font-size: 15px; width: 20px; text-align: center; }
.focus-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.focus-title { font-weight: 560; }
.focus-meta { display: flex; flex-wrap: wrap; gap: 4px 9px; align-items: center; font-size: 12.5px; color: var(--muted); }
.focus-act { display: flex; gap: 5px; flex: none; opacity: 0; transition: opacity 0.12s; }
.focus-row:hover .focus-act, .focus-row:focus-within .focus-act { opacity: 1; }
@media (hover: none) { .focus-act { opacity: 1; } }

/* --- Colonnes d'alerte -------------------------------------------- */
.att-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 12px; margin-bottom: 26px; }
.att { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; overflow: hidden; }
.att > header {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 12px 15px 10px; border-bottom: 1px solid var(--border);
}
.att > header h3 { margin: 0; font-size: 13px; font-weight: 650; }
.att > header .muted { font-size: 11.5px; }
.att-list { max-height: 300px; overflow-y: auto; }
.att-row {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 15px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.att-row:last-child { border-bottom: none; }
.att-row:hover { background: var(--surface-2); }
.att-main { flex: 1; min-width: 0; }
.att-title { display: block; font-weight: 550; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-sub { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-val { flex: none; text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
.att-when { display: block; font-size: 11.5px; color: var(--muted); }
.att-empty { padding: 22px 15px; text-align: center; color: var(--faint); font-size: 13px; }

.dotc { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--faint); display: inline-block; }
.dotc.red { background: var(--red); }

/* --- Barres de pipeline ------------------------------------------- */
.stagebars { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 11px; }
.stagebar {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 11px; padding: 12px 14px; cursor: pointer; transition: border-color 0.12s;
}
.stagebar:hover { border-color: var(--accent); }
.sb-head { display: flex; align-items: baseline; justify-content: space-between; }
.sb-name { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; }
.sb-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sb-track { height: 4px; border-radius: 2px; background: var(--surface-3); margin: 9px 0 8px; overflow: hidden; }
.sb-track span { display: block; height: 100%; border-radius: 2px; transition: width 0.4s cubic-bezier(0.4,0,0.2,1); }
.sb-val { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.sb-sub { font-size: 11.5px; color: var(--muted); }

@media (max-width: 860px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .cockpit-head h1 { font-size: 21px; }
  .focus-act .btn { padding: 3px 7px; font-size: 12px; }
}

/* ================================================================== */
/* Rapports                                                           */
/* ================================================================== */
.report-range { width: auto; }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; margin-bottom: 14px; }
.chart-card { padding: 15px 16px 12px; margin-bottom: 14px; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.chart-head h3 { margin: 0 0 1px; font-size: 14.5px; letter-spacing: -0.01em; }
.chart-head .muted { font-size: 12px; }

.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11.5px; color: var(--muted); }
.legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.legend .lg i { width: 9px; height: 9px; border-radius: 3px; flex: none; box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.25); }
.legend .lg-target { width: 11px; height: 2px; border-radius: 1px; background: var(--faint); }

/* --- Barres verticales -------------------------------------------- */
/* 16px de reserve en haut : le chiffre de la barre la plus haute deborderait sinon sur le titre. */
.chart { display: flex; gap: 8px; padding-top: 16px; }
.chart-y {
  display: flex; flex-direction: column; justify-content: space-between;
  height: var(--chart-h); flex: none; text-align: right;
  font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums;
}
.chart-y span { line-height: 1; transform: translateY(-3px); }
.chart-plot { flex: 1; min-width: 0; position: relative; }
.chart-lines { position: absolute; inset: 0 0 22px 0; display: flex; flex-direction: column; justify-content: space-between; }
.chart-lines i { display: block; height: 1px; background: var(--border); }
.chart-bars { display: flex; align-items: flex-end; gap: 4px; position: relative; }
.cbar { flex: 1; min-width: 20px; cursor: default; border-radius: 5px; }
.cbar:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cbar-plot { height: var(--chart-h); display: flex; flex-direction: column; justify-content: flex-end; position: relative; }
.cbar-fill {
  border-radius: 4px 4px 0 0; min-height: 2px; position: relative;
  transition: height 0.35s cubic-bezier(0.4,0,0.2,1);
}
.cbar-inner { position: absolute; inset: auto 0 0 0; border-radius: 4px 4px 0 0; display: block; }
.cbar-target { position: absolute; left: 12%; right: 12%; height: 2px; border-radius: 1px; background: var(--faint); }
.cbar-num {
  position: absolute; left: 50%; transform: translateX(-50%); margin-bottom: 4px;
  font-size: 10.5px; font-weight: 650; color: var(--muted); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.cbar-x {
  height: 22px; display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; color: var(--faint); white-space: nowrap; overflow: hidden;
}
.cbar:hover .cbar-fill { filter: brightness(1.08); }

/* --- Barres horizontales ------------------------------------------ */
.hbars { display: flex; flex-direction: column; gap: 7px; }
.hbar { display: grid; grid-template-columns: minmax(80px, 148px) 1fr auto; align-items: center; gap: 10px; border-radius: 6px; }
.hbar:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hb-label { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.hb-fill { display: block; height: 100%; border-radius: 4px; transition: width 0.35s cubic-bezier(0.4,0,0.2,1); }
.hb-val { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* --- Le jumeau chiffré de chaque graphique ------------------------- */
.figures { margin-top: 12px; }
.figures summary {
  cursor: pointer; font-size: 12px; color: var(--muted); list-style: none;
  padding: 4px 0; user-select: none;
}
.figures summary::-webkit-details-marker { display: none; }
.figures summary::before { content: '▸ '; }
.figures[open] summary::before { content: '▾ '; }
.figures summary:hover { color: var(--text); }

table.ftable { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.ftable th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); font-weight: 600; padding: 7px 10px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); white-space: nowrap;
}
table.ftable td { padding: 7px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.ftable tr:last-child td { border-bottom: none; }
table.ftable .r { text-align: right; }
table.ftable .green { color: var(--green); }
table.ftable tr.clickable { cursor: pointer; }
table.ftable tbody tr:hover { background: var(--surface-2); }

/* --- Tuiles d'activité --------------------------------------------- */
.act-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 9px; margin-bottom: 16px; }
.act-tile { background: var(--surface-2); border-radius: 9px; padding: 10px; text-align: center; }
.act-tile .at-ico { font-size: 15px; }
.act-tile .at-v { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.act-tile .at-k { font-size: 11px; color: var(--muted); }

/* --- Infobulle ------------------------------------------------------ */
.charttip {
  position: fixed; z-index: 90; max-width: 280px; pointer-events: none;
  background: var(--text); color: var(--bg); font-size: 12px; line-height: 1.45;
  padding: 7px 10px; border-radius: 8px; box-shadow: var(--shadow);
}

@media (max-width: 860px) {
  .chart-grid { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: minmax(70px, 110px) 1fr auto; gap: 8px; }
}

/* ---- Bannière prospection au-dessus du pipeline ---- */
.lead-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; margin-bottom: 14px;
  border: 1px dashed var(--border-strong); border-radius: 12px;
  background: var(--surface-2); color: var(--text); text-decoration: none;
  font-size: 13.5px; transition: border-color .12s, background .12s;
}
.lead-banner:hover { border-color: var(--accent); background: var(--accent-soft); }
.lead-banner-n {
  flex: none; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 8px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 15px;
  display: grid; place-items: center; font-variant-numeric: tabular-nums;
}
.lead-banner-go { margin-left: auto; color: var(--accent); font-weight: 600; white-space: nowrap; }
.col-lost { opacity: .78; }
