/* ==========================================================================
   Plus CRM — Feuille de style
   Mobile-first. Multi-colonnes activé à partir de 768px.
   ========================================================================== */

:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #dbeafe;
  --success: #10b981;
  --success-soft: #d1fae5;
  --warning: #f59e0b;
  --warning-soft: #fef3c7;
  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --violet: #8b5cf6;
  --violet-soft: #ede9fe;
  --slate: #64748b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 6px 18px rgba(15, 23, 42, .08);
  --shadow-lg: 0 18px 48px rgba(15, 23, 42, .18);
  --sidebar-w: 264px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
svg { display: block; }

/* ==========================================================================
   LAYOUT
   ========================================================================== */

.app { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: #0f172a;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  z-index: 60;
  transform: translateX(-100%);
  transition: transform .26s ease;
}

.sidebar.is-open { transform: translateX(0); }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  z-index: 55;
  opacity: 0;
  visibility: hidden;
  transition: opacity .26s ease, visibility .26s ease;
}
.sidebar-backdrop.is-open { opacity: 1; visibility: visible; }

.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, .16);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  font-weight: 800;
  font-size: 19px;
  flex: 0 0 auto;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; font-size: 17px; color: #fff; }
.brand-sub { font-size: 11.5px; color: #94a3b8; letter-spacing: .03em; text-transform: uppercase; }

.sidebar-close { margin-left: auto; color: #94a3b8; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 12px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 13px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #cbd5e1;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .15s ease, color .15s ease;
}
.nav-item:hover { background: rgba(148, 163, 184, .13); color: #fff; }
.nav-item.is-active { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(37, 99, 235, .35); }
.nav-item svg { flex: 0 0 auto; }

.sidebar-foot {
  padding: 14px;
  border-top: 1px solid rgba(148, 163, 184, .16);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-box { display: flex; align-items: center; gap: 10px; }
.avatar {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(148, 163, 184, .2);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  flex: 0 0 auto;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-name { font-size: 14px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 12px; color: #94a3b8; }

/* ==========================================================================
   TOPBAR
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { min-width: 0; flex: 1; }
.topbar-title h1 { font-size: 18px; }
.topbar-title p { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.topbar-actions { display: flex; gap: 8px; }

.menu-btn { color: var(--text-2); }

.content { padding: 16px; flex: 1; }

/* ==========================================================================
   BOUTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, color .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-light { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); }
.btn-light:hover { background: var(--surface-2); }
.btn-whatsapp { background: #25d366; color: #fff; }
.btn-whatsapp:hover { background: #1ebe5b; }
.wa-mini {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; margin-left: 4px; vertical-align: middle;
  border-radius: 6px; background: rgba(37, 211, 102, .14); color: #1ebe5b;
  transition: background .15s ease;
}
.wa-mini:hover { background: rgba(37, 211, 102, .3); }
.wa-mini svg { width: 13px; height: 13px; display: block; }
.btn-ghost { background: rgba(148, 163, 184, .12); color: #cbd5e1; }
.btn-ghost:hover { background: rgba(148, 163, 184, .22); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 7px 11px; font-size: 13px; }
.btn-block { width: 100%; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background .15s ease;
}
.icon-btn:hover { background: var(--surface-2); }

/* ==========================================================================
   CARTES / SECTIONS
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.card-head h3 { font-size: 15.5px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px 17px; }
.card-sub { font-size: 12.5px; color: var(--text-3); }

.grid { display: grid; gap: 14px; }

/* KPIs : mobile 2 colonnes, desktop 4 */
.kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kpi-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto; }
.kpi-value { font-size: 22px; font-weight: 750; letter-spacing: -.02em; }
.kpi-hint { font-size: 12px; color: var(--text-3); }
.ic-blue { background: var(--primary-soft); color: var(--primary); }
.ic-green { background: var(--success-soft); color: #047857; }
.ic-amber { background: var(--warning-soft); color: #b45309; }
.ic-violet { background: var(--violet-soft); color: #6d28d9; }
.ic-red { background: var(--danger-soft); color: #b91c1c; }

/* ==========================================================================
   TABLEAUX DE DONNÉES (cards sur mobile)
   ========================================================================== */

.table-wrap { width: 100%; overflow-x: auto; }

table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: middle;
}
table.data tbody tr { cursor: pointer; transition: background .12s ease; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }

.cell-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.cell-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-sub { font-size: 12.5px; color: var(--text-3); }
.cell-avatar {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--primary-soft); color: var(--primary-dark);
  font-weight: 700; font-size: 14px; flex: 0 0 auto;
}
.money { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ==========================================================================
   BADGES / TAGS / PASTILLES
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-client { background: var(--success-soft); color: #047857; }
.badge-prospect { background: var(--primary-soft); color: var(--primary-dark); }
.badge-inactif { background: #e2e8f0; color: var(--slate); }
.badge-planifie { background: var(--primary-soft); color: var(--primary-dark); }
.badge-termine { background: var(--success-soft); color: #047857; }
.badge-annule { background: var(--danger-soft); color: #b91c1c; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid currentColor;
  background: transparent;
}
.tag .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* ==========================================================================
   FORMULAIRES
   ========================================================================== */

.form-grid { display: grid; grid-template-columns: 1fr; gap: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--text-3); }

input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
input[type="number"], input[type="date"], input[type="datetime-local"], input[type="search"],
select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}
textarea { resize: vertical; min-height: 88px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 34px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.toolbar .grow { flex: 1 1 200px; min-width: 0; }
.search-box { position: relative; flex: 1 1 220px; min-width: 0; }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search-box input { padding-left: 36px; }

.check-row { display: flex; align-items: center; gap: 9px; }
.check-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  cursor: pointer; transition: all .15s ease;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }

.alert {
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  border: 1px solid transparent;
}
.alert-error { background: var(--danger-soft); border-color: #fecaca; color: #991b1b; }

/* ==========================================================================
   DASHBOARD
   ========================================================================== */

.dash-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 220px; }

.list-clean { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-meta { font-size: 12.5px; color: var(--text-3); }
.date-chip {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 11px;
  background: var(--surface-2); border: 1px solid var(--border);
  flex: 0 0 auto;
}
.date-chip .d { font-size: 17px; font-weight: 750; line-height: 1; }
.date-chip .m { font-size: 10px; text-transform: uppercase; color: var(--text-3); letter-spacing: .05em; }

.bar-line { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar-line > span { display: block; height: 100%; border-radius: 999px; background: var(--primary); }

/* ==========================================================================
   PIPELINE (KANBAN)
   ========================================================================== */

.kanban {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.kanban-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px;
  min-width: 0;
}
.kanban-col-head {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 4px 10px;
}
.kanban-col-head .col-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.kanban-col-head .count { font-size: 12px; font-weight: 700; color: var(--text-3); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.kanban-col-head .sum { margin-left: auto; font-size: 12.5px; font-weight: 650; color: var(--text-2); font-variant-numeric: tabular-nums; }
.kanban-col-head .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }

.kanban-body { display: flex; flex-direction: column; gap: 9px; min-height: 60px; }

.opp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}
.opp-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.opp-card.is-dragging { opacity: .45; transform: rotate(1.4deg); }
.opp-card .opp-title { font-size: 14px; font-weight: 650; margin-bottom: 5px; }
.opp-card .opp-client { font-size: 12.5px; color: var(--text-3); }
.opp-card .opp-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.opp-card .opp-amount { font-size: 14px; font-weight: 750; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.opp-card .opp-date { font-size: 11.5px; color: var(--text-3); }

.kanban-col.is-over { border-color: var(--primary); background: var(--primary-soft); }

.drag-ghost { opacity: .5; }

/* ==========================================================================
   AGENDA
   ========================================================================== */

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; padding: 7px 13px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer;
}
.seg button.is-active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

.cal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-head .month { font-size: 16px; font-weight: 700; }
.cal-scroll { overflow-x: auto; }
.cal-grid { min-width: 620px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-dow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); text-align: center; padding: 6px 0; }
.cal-cell {
  min-height: 84px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.cal-cell.is-out { background: var(--surface-2); opacity: .6; }
.cal-cell.is-today { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.cal-day { font-size: 12px; font-weight: 700; color: var(--text-2); }
.cal-ev {
  font-size: 11px; font-weight: 600;
  padding: 3px 6px; border-radius: 6px;
  background: var(--primary-soft); color: var(--primary-dark);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: pointer;
}
.cal-ev.t-tache { background: var(--warning-soft); color: #b45309; }
.cal-ev.t-appel { background: var(--violet-soft); color: #6d28d9; }
.cal-more { font-size: 10.5px; color: var(--text-3); font-weight: 600; }

.day-group { margin-bottom: 16px; }
.day-group h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin-bottom: 8px; }

/* ==========================================================================
   FICHE CLIENT (drawer)
   ========================================================================== */

.drawer {
  position: fixed; inset: 0;
  z-index: 70;
  display: flex; justify-content: flex-end;
}
.drawer[hidden] { display: none; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.5); }
.drawer-panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: var(--bg);
  height: 100%;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}
.drawer-head {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 15px 16px;
  display: flex; align-items: flex-start; gap: 12px;
}
.drawer-head .grow { flex: 1; min-width: 0; }
.drawer-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

.info-list { display: grid; grid-template-columns: 1fr; gap: 11px; }
.info-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.info-item .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); font-weight: 600; }
.info-item .v { font-size: 14px; font-weight: 550; word-break: break-word; }

.timeline { display: flex; flex-direction: column; gap: 12px; }
.tl-item { display: flex; gap: 11px; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex: 0 0 auto; }
.tl-dot.t-email { background: var(--success); }
.tl-dot.t-appel { background: var(--violet); }
.tl-dot.t-rdv { background: var(--warning); }
.tl-body { min-width: 0; flex: 1; }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-type { font-size: 12.5px; font-weight: 700; }
.tl-date { font-size: 11.5px; color: var(--text-3); }
.tl-text { font-size: 13.5px; color: var(--text-2); margin-top: 2px; }

/* ==========================================================================
   MODALE
   ========================================================================== */

.modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.55); }
.modal-panel {
  position: relative;
  width: 100%;
  max-width: 620px;
  max-height: 92vh;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 16.5px; flex: 1; }
.modal-body { padding: 16px; overflow-y: auto; }
.modal-foot { display: flex; gap: 9px; justify-content: flex-end; padding-top: 16px; flex-wrap: wrap; }

/* ==========================================================================
   TOASTS
   ========================================================================== */

.toasts {
  position: fixed;
  left: 14px; right: 14px; bottom: 14px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: #0f172a;
  color: #fff;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 550;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 9px;
  animation: toastIn .22s ease;
}
.toast.t-ok { background: #065f46; }
.toast.t-err { background: #991b1b; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   LOADER / VIDE
   ========================================================================== */

.loader { display: grid; place-items: center; padding: 60px 0; }
.spinner {
  width: 30px; height: 30px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 42px 18px; text-align: center; color: var(--text-3);
}
.empty svg { color: var(--border-strong); }
.empty h4 { font-size: 15px; color: var(--text-2); }
.empty p { font-size: 13.5px; }

.pager { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 14px; flex-wrap: wrap; }
.pager .info { font-size: 13px; color: var(--text-3); }

/* ==========================================================================
   PAGE DE CONNEXION
   ========================================================================== */

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(1100px 600px at 15% -10%, #1e3a8a 0%, #0f172a 55%, #020617 100%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 20px;
  padding: 30px 26px;
  box-shadow: var(--shadow-lg);
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.auth-brand .brand-name { color: var(--text); font-size: 19px; }
.auth-card h1 { font-size: 22px; }
.auth-sub { font-size: 13.5px; color: var(--text-3); margin-top: 4px; margin-bottom: 20px; }
.auth-form { display: flex; flex-direction: column; gap: 6px; }
.auth-form label { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-top: 8px; }
.auth-form .btn { margin-top: 18px; }
.auth-hint {
  margin-top: 18px;
  padding: 11px 13px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-2);
  text-align: center;
}
.auth-card .alert { margin-bottom: 14px; }

/* ==========================================================================
   RESPONSIVE — à partir de 640px
   ========================================================================== */

@media (min-width: 640px) {
  .content { padding: 20px; }
  .topbar { padding: 14px 20px; }
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
  .info-list { grid-template-columns: 1fr 1fr; }
  .modal { align-items: center; padding: 20px; }
  .modal-panel { border-radius: 18px; max-height: 90vh; }
  .toasts { left: auto; right: 18px; bottom: 18px; width: 340px; }
}

/* ==========================================================================
   RESPONSIVE — à partir de 768px : sidebar fixe + multi-colonnes
   ========================================================================== */

@media (min-width: 768px) {
  .sidebar { transform: translateX(0); }
  .sidebar-close { display: none; }
  .sidebar-backdrop { display: none; }
  .main { margin-left: var(--sidebar-w); }
  .menu-btn { display: none; }
  .hide-sm { display: inline; }

  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid .span-2 { grid-column: 1 / -1; }
  .form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    padding: 6px 4px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
  }
  table.data td { border-bottom: 0; padding: 7px 11px; }
  table.data td.td-hide-mobile { display: none; }
  .table-wrap { overflow: visible; }
}

/* ==========================================================================
   DESKTOP LARGE — kanban horizontal
   ========================================================================== */

@media (min-width: 1024px) {
  .content { padding: 24px; }
  .kanban { flex-direction: row; align-items: flex-start; overflow-x: auto; padding-bottom: 6px; }
  .kanban-col { flex: 0 0 268px; }
  .dash-grid { grid-template-columns: 1.6fr 1fr; }
}

/* ==========================================================================
   GLISSER-DÉPOSER — poignée du kanban
   ========================================================================== */

.opp-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  touch-action: pan-y;
}
.opp-main { flex: 1; min-width: 0; }

.opp-handle {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text-3);
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  transition: background .15s ease, color .15s ease;
}
.opp-handle:hover { background: var(--primary-soft); color: var(--primary); }
.opp-handle:active { cursor: grabbing; background: var(--primary-soft); color: var(--primary); }

.drag-ghost {
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
  opacity: .9;
}

@media (min-width: 1024px) {
  .opp-handle { width: 28px; height: 28px; }
}
