/* Voltis Leads — feuille de style */
:root {
  --ink: #14213D;
  --ink-2: #33415C;
  --muted: #5F6E86;
  --line: #D9DFE8;
  --line-soft: #E8ECF2;
  --canvas: #EEF1F5;
  --surface: #FFFFFF;
  --surface-2: #F6F8FB;
  --action: #0E6E6D;
  --action-ink: #FFFFFF;
  --action-soft: #DDF0EF;
  --danger: #C62828;
  --warn-bg: #FFF4D6;
  --warn-ink: #6B4E00;
  --focus: #2F6FED;
  --tint: 34%;
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;
  --shadow-pop: 0 18px 50px -12px rgba(20, 33, 61, .35);
  --font: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #E8EDF5; --ink-2: #C3CCDA; --muted: #8F9CB2; --line: #2B3647; --line-soft: #222C3B;
    --canvas: #0F1622; --surface: #172131; --surface-2: #1C2738; --action: #2BB3B0; --action-ink: #06201F;
    --action-soft: #12393A; --warn-bg: #3A3010; --warn-ink: #F5DA8A; --tint: 30%;
    --shadow-pop: 0 18px 50px -12px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--ink);
  background: var(--canvas); font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--action); }
code { font-size: .92em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Boutons et champs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); color: var(--ink);
  font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--action); border-color: var(--action); color: var(--action-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.primary.destructive { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.block { width: 100%; min-height: 44px; }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }

input[type=text], input[type=search], input[type=password], input[type=date], input[type=datetime-local], input:not([type]), select, textarea {
  width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface); color: var(--ink);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input[type=color] { width: 40px; height: 32px; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); cursor: pointer; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--action); cursor: pointer; }

.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.form fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 12px; }
.form legend { font-weight: 700; font-size: 15px; margin-bottom: 4px; color: var(--ink); }
.form .check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.alert { padding: 10px 12px; border-radius: var(--radius-s); font-size: 13.5px; }
.alert.error { background: #FDE8E8; color: #8A1C1C; }
.alert.warn { background: var(--warn-bg); color: var(--warn-ink); }
.alert.ok { background: var(--action-soft); color: var(--ink); }
pre.code { background: var(--surface-2); padding: 12px; border-radius: var(--radius-s); overflow-x: auto; font-size: 12.5px; user-select: all; }

/* ---------- Connexion / installation ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: var(--radius-l); padding: 28px; box-shadow: var(--shadow-pop); }
.auth-card.wide { max-width: 560px; }
.auth-card h1 { font-size: 22px; margin: 22px 0 14px; letter-spacing: -.01em; }
.auth-card h2 { font-size: 15px; margin: 18px 0 8px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand strong { display: block; font-size: 15px; letter-spacing: -.01em; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; font-weight: 700; font-size: 17px;
  color: #fff; background: conic-gradient(from 200deg, #7AA45C, #F0A03C, #EE3AF0, #6FFFFF, #7AA45C);
  text-shadow: 0 1px 2px rgba(0,0,0,.45);
}
table.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
table.mini th, table.mini td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line-soft); }

/* ---------- Structure de l'application ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 18px; height: 58px; padding: 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.nav { display: flex; gap: 2px; height: 100%; }
.nav a {
  display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 100%; color: var(--muted); text-decoration: none;
  font-weight: 600; border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--ink); }
.nav a.active { color: var(--ink); border-bottom-color: var(--ink); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 11.5px; display: inline-grid; place-items: center; color: var(--ink-2); }
.badge.hot { background: var(--danger); border-color: var(--danger); color: #fff; }
.topbar .spacer { flex: 1; }
.usermenu { position: relative; }
.usermenu > button { display: flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; padding: 6px; border-radius: var(--radius-s); }
.usermenu > button:hover { background: var(--surface-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--ink); color: var(--surface); }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-m); box-shadow: var(--shadow-pop); padding: 6px; display: grid; z-index: 40;
}
.menu button { text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: var(--radius-s); cursor: pointer; }
.menu button:hover { background: var(--surface-2); }
.menu .role { padding: 8px 10px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; }

main.view { padding: 18px 20px 120px; max-width: 1800px; margin: 0 auto; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.view-head h1 { font-size: 24px; margin: 0; letter-spacing: -.02em; }
.view-head p { margin: 2px 0 0; color: var(--muted); }

/* ---------- Résumé par agent (directeur) ---------- */
.team-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: thin; }
.team-card {
  flex: none; min-width: 170px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 10px 12px; cursor: pointer; text-align: left;
}
.team-card:hover { border-color: var(--muted); }
.team-card.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.team-card .who { display: flex; justify-content: space-between; font-weight: 700; }
.team-card .who span { color: var(--muted); font-weight: 600; }
.team-card .bars { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--line-soft); margin-top: 8px; }
.team-card .bars i { display: block; height: 100%; }
.team-card .legend { margin-top: 6px; font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.team-card .legend b { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 3px; vertical-align: 0; }
.team-card.inactive { opacity: .55; }

/* ---------- Barre d'outils ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar .search { flex: 1 1 260px; position: relative; max-width: 420px; }
.toolbar .search input { padding-left: 34px; }
.toolbar .search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); padding: 2px; }
.seg button { border: 0; background: none; padding: 0 12px; white-space: nowrap; min-height: 30px; border-radius: 4px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--ink); color: var(--surface); }
.toolbar select.perpage { width: auto; min-height: 36px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--line); font-size: 12.5px; font-weight: 600;
}
.chip button { border: 0; background: var(--surface-2); width: 20px; height: 20px; border-radius: 50%; cursor: pointer; line-height: 1; }
.chip .sw { width: 10px; height: 10px; border-radius: 3px; }

/* ---------- Tableau des leads ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: auto; max-height: calc(100vh - 250px); }
table.leads { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.leads thead th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-2); text-align: left; font-weight: 600; color: var(--ink-2);
  padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12.5px;
}
table.leads thead th.sortable { cursor: pointer; user-select: none; }
table.leads thead th.sortable:hover { color: var(--ink); }
table.leads thead th .arrow { font-size: 10px; margin-left: 3px; color: var(--ink); }
table.leads td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; white-space: nowrap; }
table.leads tbody tr { background: var(--surface); }
table.leads tbody tr.colored { background: color-mix(in srgb, var(--row) var(--tint), var(--surface)); }
table.leads tbody tr.colored td:first-child { box-shadow: inset 6px 0 0 var(--row); }
table.leads tbody tr:not(.colored) td:first-child { box-shadow: inset 6px 0 0 transparent; }
table.leads tbody tr.free td:first-child { box-shadow: inset 6px 0 0 var(--action); }
table.leads tbody tr:hover td { background-image: linear-gradient(rgba(20, 33, 61, .045), rgba(20, 33, 61, .045)); }
table.leads tbody tr.selected td { background-image: linear-gradient(rgba(47, 111, 237, .13), rgba(47, 111, 237, .13)); }
table.leads td.name { font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
table.leads td.comment { max-width: 280px; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
table.leads td.chk, table.leads th.chk { width: 40px; padding-left: 16px; }
table.leads td.actions { text-align: right; position: sticky; right: 0; background: var(--surface); box-shadow: -10px 0 10px -10px rgba(20, 33, 61, .25); }
table.leads thead th:last-child { position: sticky; right: 0; z-index: 3; }
table.leads tbody tr.colored td.actions { background: color-mix(in srgb, var(--row) var(--tint), var(--surface)); }
table.leads td.actions .btn + .btn { margin-left: 4px; }
.tel { color: inherit; text-decoration: none; font-weight: 500; }
.tel:hover { text-decoration: underline; }
.when small { display: block; color: var(--muted); font-size: 11.5px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--pill); color: var(--pill-ink, #14213D); border: 1px solid color-mix(in srgb, var(--pill) 70%, #000);
}
.pill.free { background: var(--action-soft); color: var(--action); border-color: transparent; }
.agent-tag { font-weight: 600; }
.prev-tag { color: var(--muted); font-size: 12.5px; }
.dup { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 700; color: var(--warn-ink); background: var(--warn-bg); border-radius: 4px; padding: 0 5px; }
.recall-late { color: var(--danger); font-weight: 700; }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* ---------- Cartes (mobile) ---------- */
.cards { display: none; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 12px 14px 12px 18px;
  position: relative; overflow: hidden; margin-bottom: 8px;
}
.card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--row, transparent); }
.card.free::before { background: var(--action); }
.card.colored { background: color-mix(in srgb, var(--row) var(--tint), var(--surface)); }
.card .top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card .nm { font-weight: 700; font-size: 15px; }
.card .meta { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.card .facts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.card .facts span { background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; font-size: 12px; }
.card .cmt { margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.card .acts { display: flex; gap: 8px; margin-top: 10px; }
.card .acts .btn { flex: 1; min-height: 40px; }
.card .sel { position: absolute; right: 12px; bottom: 14px; }

/* ---------- Pagination ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; color: var(--muted); }
.pager .pages { display: flex; gap: 4px; align-items: center; }

/* ---------- Barre d'actions groupées ---------- */
.bulkbar {
  position: fixed; left: 0; right: 0; margin: 0 auto; width: fit-content; top: 70px; z-index: 35; display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: var(--surface); padding: 8px 8px 8px 16px; border-radius: 12px; box-shadow: var(--shadow-pop);
  max-width: calc(100vw - 24px); flex-wrap: wrap;
}
.bulkbar .btn { background: transparent; color: var(--surface); border-color: color-mix(in srgb, var(--surface) 30%, transparent); }
.bulkbar .btn:hover { background: color-mix(in srgb, var(--surface) 12%, transparent); }
.bulkbar select { width: auto; min-height: 34px; background: transparent; color: var(--surface); border-color: color-mix(in srgb, var(--surface) 30%, transparent); }
.bulkbar select option { color: #14213D; }
.bulkbar .linkish { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; padding: 0; }

/* ---------- Panneaux et fenêtres ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(15, 22, 34, .45); display: flex; justify-content: flex-end; }
.overlay.center { justify-content: center; align-items: center; padding: 16px; }
.panel {
  width: min(460px, 100vw); height: 100%; background: var(--surface); display: flex; flex-direction: column;
  box-shadow: var(--shadow-pop); animation: slidein .22s ease-out;
}
.dialog {
  width: min(620px, 100%); max-height: min(86vh, 900px); background: var(--surface); border-radius: var(--radius-l); display: flex;
  flex-direction: column; box-shadow: var(--shadow-pop); animation: pop .18s ease-out;
}
.dialog.sm { width: min(420px, 100%); }
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .panel, .dialog { animation: none; } }
.panel header, .dialog header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line-soft); }
.panel header h2, .dialog header h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.panel header p, .dialog header p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.panel .body, .dialog .body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.panel footer, .dialog footer { padding: 12px 20px; border-top: 1px solid var(--line-soft); display: flex; gap: 8px; justify-content: flex-end; }
.x { border: 0; background: var(--surface-2); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 18px; line-height: 1; flex: none; }

.facts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin-bottom: 18px; }
.facts-grid div small { display: block; color: var(--muted); font-size: 12px; }
.facts-grid div { font-weight: 600; word-break: break-word; }
.facts-grid div a { font-weight: 600; }

.status-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 6px 0 16px; }
.status-picker button {
  min-height: 46px; border-radius: var(--radius-m); border: 2px solid transparent; background: var(--pill); color: var(--pill-ink);
  font-weight: 700; cursor: pointer; padding: 6px 10px;
}
.status-picker button.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--surface) inset; }
.status-picker button.none { background: var(--surface-2); color: var(--ink-2); border-color: var(--line); }
.status-picker button.none.on { border-color: var(--ink); }
.field-title { font-weight: 700; font-size: 13px; margin: 0 0 6px; color: var(--ink-2); }

/* Historique */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; }
.timeline li::before { content: ''; position: absolute; left: 5px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); }
.timeline li::after { content: ''; position: absolute; left: 9px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .t { font-size: 12px; color: var(--muted); }
.timeline .a { font-weight: 600; }
.timeline .d { font-size: 13px; color: var(--ink-2); margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.timeline .d del { color: var(--muted); }
.timeline li.release::before, .timeline li.delete::before { background: var(--danger); }
.timeline li.restore::before { background: var(--action); }
.timeline li.take::before, .timeline li.assign::before { background: var(--action); }
.timeline li.import::before { background: var(--muted); }
.timeline li.duplicate::before { background: #C99A00; }

/* Filtres */
.filter-group { margin-bottom: 18px; }
.filter-group h3 { font-size: 13px; margin: 0 0 8px; color: var(--ink-2); }
.opt-list { display: flex; flex-wrap: wrap; gap: 6px; }
.opt {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px;
  background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13px;
}
.opt.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.opt .sw { width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(0,0,0,.15); }
.swatch-opt { width: 34px; height: 34px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.swatch-opt.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--surface) inset; }

/* Réglages */
.settings { display: grid; gap: 18px; }
.section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.section > header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.section > header h2 { font-size: 16px; margin: 0; }
.section > header p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.section .inner { padding: 14px 18px; overflow-x: auto; }
table.grid { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.grid th, table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); text-align: left; white-space: nowrap; }
table.grid th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
table.grid tr.off td { opacity: .5; }
.colorcell { display: flex; align-items: center; gap: 8px; }
.colorcell .pill { min-width: 92px; justify-content: center; }
.colorcell .reset { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; text-decoration: underline; padding: 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--action); margin-right: 6px; }
.dot.off { background: var(--muted); }

/* Notifications */
.toasts { position: fixed; top: 70px; right: 16px; z-index: 60; display: grid; gap: 8px; }
.toast { background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: var(--radius-m); box-shadow: var(--shadow-pop); max-width: 360px; font-weight: 500; }
.toast.err { background: var(--danger); color: #fff; }

.loading { opacity: .55; pointer-events: none; transition: opacity .15s; }

/* ---------- Onglets de vues ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 0 0 12px; padding-bottom: 2px; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.tab { flex: none; display: inline-flex; align-items: center; gap: 2px; border: 0; background: none; padding: 8px 12px; font-weight: 600; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--ink); }
.tab.saved { padding: 0; }
.tab.saved button { border: 0; background: none; font: inherit; color: inherit; cursor: pointer; padding: 8px 4px 8px 12px; }
.tab.saved .del { padding: 2px 8px 2px 4px; color: var(--muted); font-size: 15px; line-height: 1; }
.tab.saved .del:hover { color: var(--danger); }
.tab.add { color: var(--action); }

/* Choix des colonnes */
.colmenu { position: relative; }
.colmenu .menu { left: 0; right: auto; min-width: 230px; max-height: 60vh; overflow-y: auto; }
.check-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius-s); cursor: pointer; font-weight: 500; }
.check-row:hover { background: var(--surface-2); }

/* Édition directe dans le tableau */
select.inline { width: auto; min-height: 30px; padding: 3px 26px 3px 8px; font-size: 12.5px; font-weight: 600; border-radius: 999px; background-color: var(--surface); }
select.inline.pillish[style*="--pill"] { background-color: var(--pill); color: var(--pill-ink); border-color: color-mix(in srgb, var(--pill) 70%, #000); }
select.inline option { background: var(--surface); color: var(--ink); }
table.leads td.num, table.grid .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Fiche lead : pistes */
.track { border: 1px solid var(--line-soft); border-radius: var(--radius-m); padding: 12px 14px 4px; margin-bottom: 14px; }
.track h3 { margin: 0 0 8px; font-size: 14px; }
.track .status-picker { margin-bottom: 12px; }
.liters { display: grid; gap: 6px; font-weight: 600; font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }
.unit-input { display: flex; align-items: center; gap: 8px; }
.unit-input input { max-width: 160px; }
.pac-start { margin-bottom: 12px; border-style: dashed; color: var(--action); }
.linkish { background: none; border: 0; padding: 0 0 12px; cursor: pointer; text-decoration: underline; }

/* ---------- Statistiques ---------- */
.stats-bar .daterange { display: flex; align-items: center; gap: 6px; }
.stats-bar .daterange input { width: auto; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px; }
.kpi-v { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.kpi-l { font-weight: 600; margin-top: 4px; }
.kpi-s { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px 16px; min-width: 0; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-card h2 { font-size: 15px; margin: 0; }
.chart-card > p { margin: 2px 0 10px; color: var(--muted); font-size: 12.5px; }
.cv { position: relative; height: 260px; }
.cv.tall { height: 360px; }
.chart-card .cv.tall + * { margin-top: 0; }
.table-scroll { overflow-x: auto; margin-top: 12px; }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar .brand small, .usermenu .uname { display: none; }
  .nav { position: fixed; bottom: 0; left: 0; right: 0; height: calc(60px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 30; }
  .nav a { flex: 1; flex-direction: column; justify-content: center; gap: 2px; font-size: 12px; border-bottom: 0; border-top: 2px solid transparent; }
  .nav a.active { border-top-color: var(--ink); }
  main.view { padding: 14px 12px 150px; }
  .view-head h1 { font-size: 20px; }
  .table-wrap { display: none; }
  .cards { display: block; }
  .toolbar .search { flex-basis: 100%; max-width: none; }
  .bulkbar { top: auto; bottom: calc(72px + env(safe-area-inset-bottom)); }
  .row2, .facts-grid { grid-template-columns: 1fr; }
  .overlay.center { padding: 0; align-items: flex-end; }
  .dialog { border-radius: var(--radius-l) var(--radius-l) 0 0; max-height: 92vh; width: 100%; }
  .charts { grid-template-columns: 1fr; }
  .kpi-v { font-size: 24px; }
  .stats-bar .seg { overflow-x: auto; max-width: 100%; }
  .toasts { top: auto; bottom: calc(80px + env(safe-area-inset-bottom)); left: 12px; right: 12px; }
}

/* ---------- Bulles d'aide ---------- */
.tipbox {
  white-space: pre-line;
  position: fixed; z-index: 100; max-width: 300px; padding: 9px 12px; border-radius: 10px; pointer-events: none;
  background: var(--ink); color: var(--surface); font-size: 13px; line-height: 1.45; font-weight: 500;
  box-shadow: 0 10px 30px -8px rgba(20, 33, 61, .45);
}
.tipbox[hidden] { display: none; }
.help[data-tip] { cursor: help; text-decoration: underline dotted color-mix(in srgb, var(--muted) 70%, transparent); text-underline-offset: 4px; text-decoration-thickness: 1px; }
th[data-tip] { cursor: help; }
.kpi[data-tip] { cursor: help; }
@media (prefers-reduced-motion: no-preference) { .tipbox { animation: tipin .12s ease-out; } }
@keyframes tipin { from { opacity: 0; transform: translateY(-2px); } }

/* ---------- NRP ---------- */
.nrp-cell { white-space: nowrap; }
.nrp-n { display: inline-block; min-width: 46px; font-weight: 700; font-size: 12.5px; color: var(--ink-2); }
.nrp-n.zero { color: var(--muted); font-weight: 500; }
.nrp-n.hot { color: var(--danger); }
.nrp-plus { margin-left: 6px; min-height: 26px; padding: 0 8px; font-size: 12px; }
.card .acts .nrp-plus { margin-left: 0; font-size: 13px; }
.nrp-box { background: var(--surface-2); border-radius: var(--radius-m); padding: 10px 12px; margin-bottom: 12px; }
.nrp-box.in-history { margin-bottom: 16px; }
.nrp-big { width: 100%; min-height: 44px; border-style: dashed; font-size: 14px; }
.nrp-state { font-size: 13px; color: var(--ink-2); margin-top: 8px; }
.nrp-box.in-history .nrp-state { margin-top: 0; }
.nrp-list { margin: 6px 0 4px; padding-left: 20px; font-size: 13px; }
.nrp-list li { padding: 1px 0; }
.nrp-box .linkish { padding: 4px 0 0; }
.no-anim .panel, .no-anim .dialog { animation: none; }

/* ---------- NRP : client joint ---------- */
.nrp-ok { margin-left: 4px; min-height: 26px; padding: 0 8px; font-size: 12px; color: var(--action); border-color: color-mix(in srgb, var(--action) 45%, var(--line)); }
.nrp-box .nrp-ok { margin: 8px 0 0; min-height: 32px; }

/* ---------- Rappels ---------- */
.recall-field { display: grid; gap: 8px; border-radius: var(--radius-s); }
.recall-field label { display: grid; gap: 6px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.recall-field.need input { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent); }
.quick-dates { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-dates .opt { padding: 4px 10px; font-size: 12.5px; }
td.recall-late { white-space: nowrap; }
.agenda { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 10px 12px; margin-bottom: 12px; }
.agenda:empty { display: none; }
.agenda-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.agenda-title { font-weight: 700; }
.agenda-count { font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
button.agenda-count { cursor: pointer; }
.agenda-count.late { color: #fff; background: var(--danger); border-color: var(--danger); }
.agenda-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.agenda-chips:empty { display: none; }
.agenda-chip { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; color: var(--ink); }
.agenda-chip:hover { border-color: var(--muted); }
.agenda-chip.late { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.agenda-chip b { font-weight: 700; margin-right: 4px; }
.late-recalls { margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--danger); }
.alarms { position: fixed; left: 16px; bottom: 16px; z-index: 70; display: grid; gap: 10px; width: min(360px, calc(100vw - 32px)); }
.alarm { background: var(--surface); border: 2px solid var(--action); border-radius: var(--radius-l); box-shadow: var(--shadow-pop); padding: 12px 14px; }
@media (prefers-reduced-motion: no-preference) { .alarm { animation: pop .25s ease-out; } }
.alarm-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.alarm-t { font-weight: 700; color: var(--action); }
.alarm .x { width: 28px; height: 28px; font-size: 16px; }
.alarm-name { font-size: 17px; font-weight: 700; margin-top: 4px; }
.alarm-meta { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.alarm-meta a { font-weight: 700; }
.alarm-note { font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-radius: var(--radius-s); padding: 6px 8px; margin-top: 8px; }
.alarm-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
@media (max-width: 860px) { .alarms { right: 12px; left: 12px; width: auto; bottom: calc(76px + env(safe-area-inset-bottom)); } }
.agenda-chip.more { background: none; border-style: dashed; color: var(--action); font-weight: 600; }

/* ---------- Sélection à la souris ---------- */
body.dragging, body.dragging * { user-select: none; -webkit-user-select: none; }
body.dragging table.leads tbody tr { cursor: row-resize; }
.bulkbar .btn.on-dark { background: var(--surface); color: var(--ink); border-color: var(--surface); }
.bulkbar .btn.on-dark:hover { filter: brightness(.95); background: var(--surface); }
@media (prefers-reduced-motion: no-preference) { .bulkbar { animation: pop .15s ease-out; } }

/* ---------- Répartition ---------- */
.dist-tools { display: flex; gap: 14px; margin-bottom: 8px; }
.dist-tools .linkish { padding: 0; }
.dist-list { display: grid; gap: 6px; }
.dist-agent { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-m); cursor: pointer; }
.dist-agent:has(input:checked) { border-color: var(--action); background: var(--action-soft); }
.dist-name { font-weight: 700; }
.dist-share { font-weight: 700; color: var(--action); min-width: 34px; text-align: right; }
.dist-preview { margin: 12px 0 0; font-weight: 600; }
.free-dash { cursor: help; padding: 2px 6px; }

/* Message avec bouton (Annuler) */
.toast { display: flex; align-items: center; gap: 12px; }
.toast-act { flex: none; border: 1px solid color-mix(in srgb, var(--surface) 40%, transparent); background: transparent; color: inherit; font-weight: 700; border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.toast-act:hover { background: color-mix(in srgb, var(--surface) 15%, transparent); }
.toasts { pointer-events: none; }
.toast { pointer-events: auto; }

/* Rappels en retard : repère sur la ligne et bouton « Fait » */
.late-flag { margin-right: 6px; cursor: help; }
.recall-done { margin-left: 8px; min-height: 24px; padding: 0 8px; font-size: 12px; color: var(--action); }
.late-recalls[data-late-agent] { cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.limit-note { margin-bottom: 12px; font-weight: 600; }
.limit-note a { color: inherit; }
