/* =====================================================================
   MARH CRM — design system (crm.css)
   Référence : docs/crm/design-reference/*.png + claude_marketing.md
   Vanilla CSS, pas de framework. Importé par accounts.html + account.html.
   ===================================================================== */

/* ── Design tokens ────────────────────────────────────────────────── */
:root {
  /* Accent (indigo Lovable) */
  --accent: #5E6AD2;
  --accent-hover: #4E5AC2;
  --accent-soft: #EEF0FA;
  --accent-soft-2: #E4E7F7;

  /* Stage palette */
  --stage-cold:    #6B7280;
  --stage-cold-bg: #F3F4F6;
  --stage-warm:    #D97706;
  --stage-warm-bg: #FEF3C7;
  --stage-hot:     #DC2626;
  --stage-hot-bg:  #FEE2E2;
  --stage-engaged: #2563EB;
  --stage-engaged-bg: #DBEAFE;
  --stage-signed:  #059669;
  --stage-signed-bg: #D1FAE5;
  --stage-lost:    #9CA3AF;
  --stage-lost-bg: #F3F4F6;

  /* Status (contacts / activities) */
  --status-new:       #6B7280;
  --status-new-bg:    #F3F4F6;
  --status-contacted: #059669;
  --status-contacted-bg: #D1FAE5;
  --status-replied:   #2563EB;
  --status-replied-bg: #DBEAFE;
  --status-bounced:   #DC2626;
  --status-bounced-bg: #FEE2E2;

  /* Score bar */
  --score-bar: #EF4444;

  /* Neutral */
  --text:       #1A1A1A;
  --text-muted: #6B7280;
  --text-light: #9CA3AF;
  --border:     #E5E7EB;
  --border-light: #F3F4F6;
  --bg:         #FFFFFF;
  --bg-soft:    #FAFAFA;
  --bg-hover:   #F9FAFB;

  /* Semantic */
  --danger:  #DC2626;
  --warning: #D97706;
  --success: #059669;
  --info:    #2563EB;

  /* Spacing */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;

  /* Radius */
  --r-1: 4px;
  --r-2: 6px;
  --r-3: 8px;
  --r-4: 12px;
  --r-full: 999px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);

  /* Font */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

/* ── Reset ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-soft);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── App shell ────────────────────────────────────────────────────── */
.crm-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.crm-main {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* Sidebar (detail page only) */
.crm-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: var(--s-5) var(--s-4);
  overflow-y: auto;
}
.crm-sidebar-back {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
  padding: var(--s-2) 0;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.crm-sidebar-back:hover { color: var(--accent); }
.crm-sidebar-section {
  margin-top: var(--s-6);
}
.crm-sidebar-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  font-weight: 600;
  margin-bottom: var(--s-3);
}
.crm-sidebar-item {
  display: block;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-2);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 2px;
}
.crm-sidebar-item:hover { background: var(--bg-hover); text-decoration: none; }
.crm-sidebar-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}
.crm-sidebar-item .sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.crm-sidebar-item.active .sub { color: var(--accent); opacity: 0.75; }

/* Main content area */
.crm-content {
  flex: 1;
  min-width: 0;
  padding: var(--s-6) var(--s-8);
  overflow-y: auto;
}
.crm-content--wide { padding: var(--s-5) var(--s-6); }

/* ── Demo banner ──────────────────────────────────────────────────── */
.demo-banner {
  background: #FEF9C3;
  border-bottom: 1px solid #FDE68A;
  color: #713F12;
  padding: var(--s-2) var(--s-5);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.demo-banner-icon {
  flex-shrink: 0;
  color: #CA8A04;
}
.demo-banner-strong { font-weight: 600; }

/* ── Page header ──────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-5);
  gap: var(--s-4);
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.page-actions { display: flex; gap: var(--s-3); align-items: center; }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 7px var(--s-4);
  border-radius: var(--r-2);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); }
.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover { background: var(--bg-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: #FEF2F2; }
.btn-sm { padding: 5px var(--s-3); font-size: 12px; }
.btn-icon { padding: 6px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-sm svg { width: 12px; height: 12px; }

/* Dropdown wrap */
.btn-dropdown { position: relative; }
.btn-dropdown svg.chev { width: 12px; height: 12px; opacity: 0.6; }

/* ── Search bar (accounts list) ───────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: var(--s-2) var(--s-3);
  margin-bottom: var(--s-4);
}
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-bar svg { width: 16px; height: 16px; color: var(--text-light); flex-shrink: 0; }
.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: var(--text);
  padding: var(--s-1) 0;
}
.search-bar input::placeholder { color: var(--text-light); }
.search-bar kbd {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-1);
  padding: 1px 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* ── Stats pills row ──────────────────────────────────────────────── */
.stats-row {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  margin-bottom: var(--s-4);
}
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 5px var(--s-3);
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .12s;
}
.stat-pill:hover { border-color: var(--text-light); background: var(--bg-hover); }
.stat-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent-soft-2);
  color: var(--accent);
}
.stat-pill strong {
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
}
.stat-pill.active strong { color: var(--accent); }

/* ── Filter pills row ─────────────────────────────────────────────── */
.filters-row {
  display: flex;
  gap: var(--s-2);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--s-4);
}
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 5px var(--s-3);
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: all .12s;
  position: relative;
}
.filter-pill:hover { border-color: var(--text-light); background: var(--bg-hover); }
.filter-pill.has-value {
  background: var(--accent-soft);
  border-color: var(--accent-soft-2);
  color: var(--accent);
  font-weight: 500;
}
.filter-pill svg { width: 12px; height: 12px; opacity: 0.6; }
.filter-pill .clear {
  margin-left: 2px;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  opacity: 0.7;
}
.filter-pill .clear:hover { background: rgba(94,106,210,.2); opacity: 1; }

.filter-pill-spacer { flex: 1; }

/* Dropdown menu */
.menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  box-shadow: var(--shadow-md);
  padding: var(--s-2) 0;
  z-index: 100;
  max-height: 320px;
  overflow-y: auto;
}
.menu-right { left: auto; right: 0; }
.menu-item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 7px var(--s-3);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.menu-item:hover { background: var(--bg-hover); }
.menu-item.selected { color: var(--accent); font-weight: 500; }
.menu-item.selected::after { content: "✓"; margin-left: auto; color: var(--accent); }
.menu-divider { height: 1px; background: var(--border); margin: var(--s-2) 0; }
.menu-section {
  padding: var(--s-2) var(--s-3) var(--s-1);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  font-weight: 600;
}
.menu-search {
  padding: var(--s-2);
  border-bottom: 1px solid var(--border-light);
}
.menu-search input {
  width: 100%;
  padding: 5px var(--s-2);
  border: 1px solid var(--border);
  border-radius: var(--r-1);
  font-size: 12px;
  outline: none;
}

/* ── Accounts table ───────────────────────────────────────────────── */
.accounts-table {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  overflow: hidden;
}
.accounts-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.accounts-table thead th {
  text-align: left;
  padding: var(--s-3) var(--s-4);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  font-weight: 600;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.accounts-table tbody td {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.accounts-table tbody tr {
  cursor: pointer;
  transition: background .1s;
}
.accounts-table tbody tr:hover { background: var(--bg-hover); }
.accounts-table tbody tr:last-child td { border-bottom: none; }
.accounts-table .cell-checkbox { width: 30px; }
.accounts-table .cell-name { min-width: 220px; }
.accounts-table .cell-stage { width: 110px; }
.accounts-table .cell-score { width: 140px; }
.accounts-table .cell-owner { width: 180px; }
.accounts-table .cell-last { width: 140px; }

.account-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.account-name .stars { color: #D97706; font-size: 11px; letter-spacing: 1px; }
.account-name .hotel-stars { color: #D97706; font-size: 10px; opacity: 0.85; }
.account-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Stage badge ──────────────────────────────────────────────────── */
.stage-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 3px var(--s-3);
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 500;
}
.stage-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.stage-cold     { background: var(--stage-cold-bg);    color: var(--stage-cold); }
.stage-warm     { background: var(--stage-warm-bg);    color: var(--stage-warm); }
.stage-hot      { background: var(--stage-hot-bg);     color: var(--stage-hot); }
.stage-engaged  { background: var(--stage-engaged-bg); color: var(--stage-engaged); }
.stage-signed   { background: var(--stage-signed-bg);  color: var(--stage-signed); }
.stage-lost     { background: var(--stage-lost-bg);    color: var(--stage-lost); }

/* ── Score bar ────────────────────────────────────────────────────── */
.score {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.score-bar {
  flex: 1;
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
  max-width: 90px;
}
.score-bar-fill {
  height: 100%;
  background: var(--score-bar);
  border-radius: 2px;
  transition: width .25s;
}

/* ── Owner avatar ─────────────────────────────────────────────────── */
.owner {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 13px;
  color: var(--text);
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.avatar-lg { width: 40px; height: 40px; font-size: 14px; }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }

/* Date relative */
.date-rel {
  font-size: 13px;
  color: var(--text-muted);
}

/* Loading / empty */
.table-loading,
.table-empty {
  padding: var(--s-8);
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
}
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: var(--s-2);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Detail page ──────────────────────────────────────────────────── */
.detail-header { margin-bottom: var(--s-5); }
.detail-titlebar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-3);
}
.detail-title-block { min-width: 0; flex: 1; }
.detail-title {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: 0 0 var(--s-2);
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
}
.detail-title .stars { color: #D97706; font-size: 16px; letter-spacing: 2px; }
.detail-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.detail-breadcrumb-sep { color: var(--text-light); }

.detail-meta {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  font-size: 13px;
  color: var(--text-muted);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
}
.detail-meta-item { display: flex; align-items: center; gap: var(--s-2); }
.detail-meta-item strong { color: var(--text); font-weight: 600; }
.detail-meta-item .owner-select {
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  padding: 3px var(--s-2);
  font-size: 13px;
  background: var(--bg);
}

/* ── Tabs ─────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--s-5);
  margin-top: var(--s-5);
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
  transition: all .12s;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.tab svg { width: 16px; height: 16px; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Fiche tab (form 2 columns) ──────────────────────────────────── */
.fiche-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 var(--s-8);
}
.fiche-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: var(--s-4);
  align-items: center;
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--border-light);
}
.fiche-label {
  font-size: 13px;
  color: var(--text-muted);
}
.fiche-value {
  font-size: 14px;
  color: var(--text);
  min-width: 0;
}
.fiche-value.empty { color: var(--text-light); }

/* Editable field */
.fld {
  display: inline-block;
  width: 100%;
  padding: 5px var(--s-2);
  margin: -5px calc(-1 * var(--s-2));
  border: 1px solid transparent;
  border-radius: var(--r-2);
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  transition: all .12s;
}
.fld:hover { background: var(--bg-hover); }
.fld:focus {
  background: var(--bg);
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.fld.saving { background: #FFFBEB; border-color: #FCD34D; }
.fld.saved { background: #ECFDF5; border-color: #6EE7B7; }
.fld[readonly] { cursor: default; }
.fld[readonly]:hover { background: transparent; }
select.fld { appearance: auto; }

/* ── Cards (contacts / opportunities / notes) ────────────────────── */
.section-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: var(--s-5);
  margin-bottom: var(--s-4);
}
.section-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-4);
}
.section-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.section-card-title .count {
  color: var(--text-muted);
  font-weight: 500;
  margin-left: var(--s-1);
}

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: var(--s-4);
  margin-bottom: var(--s-3);
  transition: border-color .12s;
}
.card:hover { border-color: var(--accent-soft-2); }
.card:last-child { margin-bottom: 0; }

/* Contact card */
.contact-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--s-3);
  align-items: start;
}
.contact-info { min-width: 0; }
.contact-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.contact-name a.linkedin {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}
.contact-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.contact-meta {
  text-align: right;
  font-size: 11px;
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--s-2);
}

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 2px var(--s-2);
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 500;
}
.status-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.status-new       { background: var(--status-new-bg);       color: var(--status-new); }
.status-contacted { background: var(--status-contacted-bg); color: var(--status-contacted); }
.status-replied   { background: var(--status-replied-bg);   color: var(--status-replied); }
.status-bounced   { background: var(--status-bounced-bg);   color: var(--status-bounced); }
.status-blacklisted { background: #FEE2E2; color: #DC2626; }

/* Opportunity card */
.opp-header {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
  flex-wrap: wrap;
}
.opp-position { font-size: 14px; font-weight: 600; color: var(--text); }
.opp-tag {
  display: inline-block;
  padding: 2px var(--s-2);
  border-radius: var(--r-1);
  font-size: 11px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.opp-fields {
  display: flex;
  gap: var(--s-5);
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.opp-fields strong { color: var(--text); font-weight: 600; }
.proba-bar {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}
.proba-bar-track {
  width: 80px;
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
}
.proba-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

/* Note card */
.note-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-soft-2);
  border-radius: var(--r-3);
  padding: var(--s-4);
  margin-bottom: var(--s-3);
  position: relative;
}
.note-card.pinned {
  border-left-color: #FBBF24;
  background: #FFFCEB;
}
.note-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-2);
}
.note-author {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.note-pin {
  cursor: pointer;
  color: var(--text-light);
  display: inline-flex;
  padding: 2px;
  border-radius: var(--r-1);
}
.note-pin.pinned { color: #F59E0B; }
.note-pin:hover { background: var(--bg-hover); }
.note-date {
  font-size: 11px;
  color: var(--text-light);
}
.note-body {
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.5;
}

/* ── Activity timeline ───────────────────────────────────────────── */
.timeline { padding: var(--s-2) 0; }
.timeline-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  align-items: flex-start;
  border-bottom: 1px solid var(--border-light);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.timeline-icon.email-out  { background: var(--status-replied-bg); color: var(--status-replied); }
.timeline-icon.email-in   { background: var(--status-contacted-bg); color: var(--status-contacted); }
.timeline-icon.linkedin   { background: #FFEDD5; color: #C2410C; }
.timeline-icon.phone      { background: var(--accent-soft); color: var(--accent); }
.timeline-icon.event      { background: var(--bg-soft); color: var(--text-muted); }
.timeline-icon svg { width: 14px; height: 14px; }

.timeline-body { min-width: 0; }
.timeline-head {
  font-size: 13px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}
.timeline-head strong { color: var(--text); font-weight: 600; }
.timeline-channel { color: var(--text-muted); font-weight: 500; }
.timeline-dir {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--r-full);
  font-size: 10px;
  font-weight: 500;
  text-transform: lowercase;
}
.timeline-dir.in  { background: var(--status-contacted-bg); color: var(--status-contacted); }
.timeline-dir.out { background: var(--accent-soft); color: var(--accent); }
.timeline-subject {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}
.timeline-excerpt {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.timeline-date {
  font-size: 11px;
  color: var(--text-light);
  white-space: nowrap;
  margin-top: 2px;
}

/* ── Modal ────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--s-5);
  animation: overlay-in .15s;
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg);
  border-radius: var(--r-4);
  box-shadow: 0 25px 50px rgba(0,0,0,.25);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: modal-in .18s;
}
.modal-lg { max-width: 720px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  padding: var(--s-1);
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: var(--s-5); overflow-y: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--border);
}

/* Form fields in modal */
.form-group { margin-bottom: var(--s-4); }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: var(--s-2);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 7px var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .12s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-group textarea { min-height: 100px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }

/* ── Toast ────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--s-5);
  right: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  z-index: 2000;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: white;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-3);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: toast-in .2s, toast-out .2s 2.6s forwards;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.info    { background: var(--info); }
.toast svg { width: 16px; height: 16px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }

/* ── Utility ──────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: var(--s-2); }
.col { display: flex; flex-direction: column; }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.mb-2 { margin-bottom: var(--s-2); }
.mb-3 { margin-bottom: var(--s-3); }
.mb-4 { margin-bottom: var(--s-4); }
.text-muted { color: var(--text-muted); }
.text-light { color: var(--text-light); }
.text-sm   { font-size: 12px; }
.text-strong { font-weight: 600; }

/* Empty states */
.empty-state {
  text-align: center;
  padding: var(--s-8);
  color: var(--text-light);
}
.empty-state-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--s-3);
  color: var(--text-light);
  opacity: 0.7;
}
.empty-state h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 var(--s-2);
}
.empty-state p { font-size: 13px; margin: 0; }

/* Sentinel for scroll infini */
.infinite-sentinel {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 12px;
}

/* Responsive */
@media (max-width: 900px) {
  .crm-sidebar { display: none; }
  .crm-content { padding: var(--s-4); }
  .fiche-grid { grid-template-columns: 1fr; gap: 0; }
  .accounts-table .cell-owner,
  .accounts-table .cell-last { display: none; }
}

/* =====================================================================
   Header CRM (crm-header.js)
   Sticky en haut, palette indigo, logo + nav interne + quick access RH
   ===================================================================== */
.crm-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: var(--s-4);
  height: 56px;
  padding: 0 var(--s-5);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  flex-shrink: 0;
}

/* Logo + titre */
.crm-header-brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  margin-right: var(--s-3);
}
.crm-header-brand:hover { opacity: 0.85; }
.crm-header-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-2);
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.02em;
}
.crm-header-brand-text { color: var(--text-muted); font-weight: 500; }
.crm-header-brand-text strong { color: var(--text); font-weight: 600; }

/* Nav interne */
.crm-header-nav {
  display: flex;
  align-items: center;
  gap: var(--s-1);
}
.crm-header-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-2);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  transition: background 0.12s, color 0.12s;
}
.crm-header-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.crm-header-nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.crm-header-nav-item.is-external .crm-header-ext-icon { opacity: 0.5; }
.crm-header-nav-item.is-external:hover .crm-header-ext-icon { opacity: 1; }

.crm-header-ext-icon {
  display: inline-flex;
  width: 12px;
  height: 12px;
  color: currentColor;
}
.crm-header-ext-icon svg { width: 100%; height: 100%; }
.crm-header-ext-icon--small { width: 10px; height: 10px; }

/* Spacer pour pousser les actions à droite */
.crm-header-spacer { flex: 1; min-width: var(--s-4); }

/* Quick actions (à droite) */
.crm-header-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.crm-header-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--r-2);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 12.5px;
  transition: background 0.12s, color 0.12s;
}
.crm-header-action:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.crm-header-action-icon {
  display: inline-flex;
  width: 14px;
  height: 14px;
}
.crm-header-action-icon svg { width: 100%; height: 100%; }
.crm-header-action--accent {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.crm-header-action--accent:hover {
  background: var(--accent-soft-2);
  color: var(--accent-hover);
}

/* User menu */
.crm-header-user-wrap {
  position: relative;
  margin-left: var(--s-2);
}
.crm-header-user-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  border-radius: var(--r-full);
  padding: 0;
  cursor: pointer;
  transition: box-shadow 0.12s;
}
.crm-header-user-btn:hover {
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.crm-header-user-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft-2);
}
.crm-header-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  color: white;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: -0.02em;
}

.crm-header-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 260px;
  padding: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  box-shadow: var(--shadow-md);
  z-index: 110;
}
.crm-header-menu[hidden] { display: none; }
.crm-header-menu-info {
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 4px;
}
.crm-header-menu-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.crm-header-menu-email {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  word-break: break-all;
}
.crm-header-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  border-radius: var(--r-2);
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.crm-header-menu-item:hover { background: var(--bg-hover); }
.crm-header-menu-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}
.crm-header-menu-icon svg { width: 100%; height: 100%; }

/* Responsive header — masque les labels sur petit écran */
@media (max-width: 1100px) {
  .crm-header-brand-text { display: none; }
  .crm-header-action-label { display: none; }
}
@media (max-width: 900px) {
  .crm-header { padding: 0 var(--s-3); gap: var(--s-2); }
  .crm-header-nav-item span:not(.crm-header-ext-icon) { font-size: 12.5px; }
}
@media (max-width: 700px) {
  .crm-header-nav .crm-header-nav-item.is-external { display: none; }
  .crm-header-action:not(.crm-header-action--accent) { display: none; }
}
