  :root {
    --bg: #0c0e16;
    --surface: #13161f;
    --surface2: #1c2030;
    --surface3: #242840;
    --border: #272b3d;
    --border2: #323756;
    --accent: #5b73f8;
    --accent-hover: #4a60e8;
    --accent2: #7c3aed;
    --green: #10b981;
    --yellow: #f59e0b;
    --red: #ef4444;
    --text: #e8ecf4;
    --text2: #a0aab8;
    --muted: #5a6378;
    --radius: 10px;
    --shadow: 0 2px 12px rgba(0,0,0,.35);
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.5; -webkit-font-smoothing: antialiased; }

  /* NAV */
  nav { display: flex; align-items: center; background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 20px; height: 54px; gap: 0; position: sticky; top: 0; z-index: 100; }
  .logo { font-weight: 800; font-size: 17px; color: var(--accent); margin-right: 28px; letter-spacing: -.5px; white-space: nowrap; }
  .nav-tabs { display: flex; gap: 2px; }
  .nav-tab { padding: 5px 13px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--muted); border: none; background: none; transition: all .15s; font-weight: 500; white-space: nowrap; }
  .nav-tab:hover { color: var(--text2); background: var(--surface2); }
  .nav-tab.active { color: #fff; background: var(--accent); }
  .nav-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
  .badge-notif { background: var(--red); color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 99px; font-weight: 700; }
  .sync-indicator { display:flex; align-items:center; gap:5px; font-size:12px; padding:4px 10px; border-radius:99px; border:1px solid var(--border); cursor:pointer; transition:all .2s; user-select:none; color: var(--text2); }
  .sync-indicator:hover { border-color:var(--accent); color:var(--text); }
  .sync-dot { width:7px; height:7px; border-radius:50%; flex-shrink:0; }
  .sync-dot.synced  { background:var(--green); box-shadow:0 0 5px var(--green); }
  .sync-dot.local   { background:var(--yellow); }
  .sync-dot.syncing { background:var(--accent); animation:pulse .8s infinite; }
  .sync-dot.error   { background:var(--red); }

  /* LAYOUT */
  .page { display: none; padding: 24px 28px; max-width: 1400px; margin: 0 auto; }
  .page.active { display: block; }
  .page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
  h1 { font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
  h2 { font-size: 15px; font-weight: 600; color: var(--text2); margin-bottom: 14px; }

  /* BUTTONS */
  .btn { padding: 7px 16px; border-radius: 7px; border: none; cursor: pointer; font-size: 13px; font-weight: 600; transition: all .15s; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
  .btn-primary { background: var(--accent); color: #fff; }
  .btn-primary:hover { background: var(--accent-hover); }
  .btn-sm { padding: 4px 11px; font-size: 12px; }
  .btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border2); }
  .btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: rgba(91,115,248,.06); }
  .btn-danger { background: var(--red); color: #fff; }

  /* DASHBOARD */
  .stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
  .stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; transition: border-color .2s; }
  .stat-card:hover { border-color: var(--border2); }
  .stat-label { font-size: 12px; color: var(--muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
  .stat-value { font-size: 30px; font-weight: 800; letter-spacing: -.5px; line-height: 1; }
  .stat-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
  .stat-up { color: var(--green); }
  .stat-down { color: var(--red); }

  .dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
  .card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }
  .card h2 { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 14px; text-transform: uppercase; letter-spacing: .5px; }

  /* RELANCES */
  .relance-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .relance-item:last-child { border-bottom: none; }
  .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent2); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
  .relance-info { flex: 1; }
  .relance-name { font-size: 14px; font-weight: 500; }
  .relance-date { font-size: 12px; color: var(--red); }
  .tag { padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 500; }
  .tag-acheteur { background: rgba(79,110,247,.15); color: var(--accent); }
  .tag-vendeur { background: rgba(124,58,237,.15); color: #a78bfa; }
  .tag-locataire { background: rgba(16,185,129,.15); color: var(--green); }

  /* CHART SIMPLE */
  .bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 100px; margin-top: 8px; }
  .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
  .bar { width: 100%; border-radius: 4px 4px 0 0; background: var(--accent); opacity: .7; transition: opacity .2s; }
  .bar:hover { opacity: 1; }
  .bar-label { font-size: 11px; color: var(--muted); }
  .bar-val { font-size: 11px; color: var(--muted); }

  /* CRM TABLE */
  .toolbar { display: flex; gap: 10px; margin-bottom: 18px; align-items: center; }
  .search-input { flex: 1; background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 8px 14px; border-radius: 7px; font-size: 14px; outline: none; }
  .search-input:focus { border-color: var(--accent); }
  select.filter { background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 7px; font-size: 14px; outline: none; cursor: pointer; }

  table { width: 100%; border-collapse: collapse; }
  th { text-align: left; font-size: 11px; font-weight: 700; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: .6px; }
  td { padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--border); }
  tr:hover td { background: rgba(91,115,248,.04); }
  tr:last-child td { border-bottom: none; }

  .status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
  .dot-new { background: var(--yellow); }
  .dot-contacted { background: var(--accent); }
  .dot-rdv { background: #a78bfa; }
  .dot-mandat { background: var(--green); }
  .dot-closed { background: var(--muted); }

  .action-btns { display: flex; gap: 6px; }

  /* PIPELINE KANBAN */
  .kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; }
  .kanban-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; min-height: 300px; }
  .kanban-col-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
  .kanban-col-title { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
  .kanban-count { background: var(--surface2); color: var(--muted); font-size: 12px; padding: 1px 8px; border-radius: 99px; }
  .kanban-card { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 8px; cursor: grab; transition: box-shadow .2s; }
  .kanban-card:hover { box-shadow: 0 0 0 1px var(--accent); }
  .kcard-name { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
  .kcard-info { font-size: 12px; color: var(--muted); }
  .kcard-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
  .kcard-date { font-size: 11px; color: var(--muted); }
  .kcard-move { font-size: 11px; color: var(--accent); cursor: pointer; text-decoration: none; }
  .kcard-move:hover { text-decoration: underline; }

  /* BIENS */
  .biens-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .bien-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
  .bien-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
  .bien-type { font-size: 12px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .5px; }
  .bien-price { font-size: 18px; font-weight: 700; }
  .bien-addr { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
  .bien-specs { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
  .bien-spec span { font-weight: 600; color: var(--text); }
  .bien-prospect { font-size: 12px; color: var(--muted); background: var(--surface2); padding: 5px 10px; border-radius: 6px; }

  /* MODAL */
  .modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100; align-items: center; justify-content: center; }
  .modal-overlay.open { display: flex; }
  .modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 26px; width: 480px; max-width: 95vw; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow); }
  .modal h2 { font-size: 17px; font-weight: 700; margin-bottom: 18px; }
  .form-row { margin-bottom: 13px; }
  label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 5px; font-weight: 600; letter-spacing: .2px; }
  .form-input { width: 100%; background: var(--surface2); border: 1px solid var(--border2); color: var(--text); padding: 9px 12px; border-radius: 8px; font-size: 13px; outline: none; transition: border-color .15s; }
  .form-input:focus { border-color: var(--accent); background: var(--surface3); }
  select.form-input { cursor: pointer; }
  textarea.form-input { resize: vertical; }
  .form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 13px; }
  .modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; border-top: 1px solid var(--border); padding-top: 16px; }

  /* TOAST */
  .toast { position: fixed; bottom: 24px; right: 24px; background: var(--green); color: #fff; padding: 12px 20px; border-radius: 8px; font-size: 14px; font-weight: 500; z-index: 200; transform: translateY(60px); opacity: 0; transition: all .3s; pointer-events: none; }
  .toast.show { transform: translateY(0); opacity: 1; }

  /* RELANCES PAGE */
  .relances-banner { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); border-radius: var(--radius); padding: 14px 20px; margin-bottom: 20px; display: flex; align-items: center; gap: 12px; }
  .relances-banner.hidden { display: none; }
  .banner-icon { font-size: 22px; }
  .banner-text { flex: 1; font-size: 14px; }
  .banner-text strong { color: var(--red); }
  .relances-tabs { display: flex; gap: 4px; margin-bottom: 20px; }
  .rtab { padding: 7px 18px; border-radius: 7px; border: 1px solid var(--border); background: none; color: var(--muted); font-size: 13px; cursor: pointer; transition: all .2s; }
  .rtab.active { background: var(--surface2); color: var(--text); border-color: var(--accent); }
  .relance-row { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 14px 16px; margin-bottom: 10px; transition: all .2s; }
  .relance-row.overdue { border-color: rgba(239,68,68,.4); }
  .relance-row.today { border-color: rgba(245,158,11,.4); }
  .relance-row.done { opacity: .45; }
  .relance-row:hover { border-color: var(--accent); }
  .rel-avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
  .rel-body { flex: 1; }
  .rel-name { font-size: 15px; font-weight: 600; margin-bottom: 3px; }
  .rel-meta { font-size: 13px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
  .rel-due { font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: 99px; }
  .rel-due.overdue { background: rgba(239,68,68,.15); color: var(--red); }
  .rel-due.today { background: rgba(245,158,11,.15); color: var(--yellow); }
  .rel-due.upcoming { background: rgba(79,110,247,.15); color: var(--accent); }
  .rel-due.done-label { background: rgba(16,185,129,.15); color: var(--green); }
  .rel-actions { display: flex; gap: 8px; flex-shrink: 0; }
  .snooze-menu { position: relative; display: inline-block; }
  .snooze-dropdown { display: none; position: absolute; right: 0; top: 110%; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; min-width: 150px; z-index: 50; overflow: hidden; }
  .snooze-dropdown.open { display: block; }
  .snooze-option { padding: 9px 14px; font-size: 13px; cursor: pointer; }
  .snooze-option:hover { background: var(--surface2); }
  .rel-note { font-size: 12px; color: var(--muted); font-style: italic; margin-top: 4px; }
  .history-entry { font-size: 13px; color: var(--muted); padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; }
  .history-entry:last-child { border-bottom: none; }
  .history-time { color: var(--accent); min-width: 120px; }
  .auto-rule { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 16px; margin-bottom: 10px; display: flex; align-items: center; gap: 14px; }
  .rule-icon { font-size: 20px; }
  .rule-body { flex: 1; }
  .rule-title { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
  .rule-desc { font-size: 13px; color: var(--muted); }
  .toggle { width: 40px; height: 22px; border-radius: 99px; border: none; cursor: pointer; position: relative; transition: background .2s; flex-shrink: 0; }
  .toggle.on { background: var(--green); }
  .toggle.off { background: var(--border); }
  .toggle::after { content: ''; width: 16px; height: 16px; border-radius: 50%; background: #fff; position: absolute; top: 3px; transition: left .2s; }
  .toggle.on::after { left: 21px; }
  .toggle.off::after { left: 3px; }

  /* EMAIL CONFIG */
  .email-config-bar { display: flex; align-items: center; gap: 12px; background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; padding: 12px 18px; margin-bottom: 20px; }
  .config-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
  .config-dot.connected { background: var(--green); box-shadow: 0 0 6px var(--green); }
  .config-dot.disconnected { background: var(--red); }
  .sent-status-badge { padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; }
  .sent-status-badge.ok   { background: rgba(16,185,129,.15); color: var(--green); }
  .sent-status-badge.fail { background: rgba(239,68,68,.15);  color: var(--red);   }
  .sent-status-badge.pending { background: rgba(79,110,247,.15); color: var(--accent); }
  /* wizard */
  .wizard-steps { display: flex; gap: 0; margin-bottom: 24px; }
  .wizard-step  { flex: 1; text-align: center; position: relative; }
  .wizard-step::after { content:''; position:absolute; top:14px; left:50%; width:100%; height:2px; background:var(--border); z-index:0; }
  .wizard-step:last-child::after { display:none; }
  .ws-circle { width:28px; height:28px; border-radius:50%; border:2px solid var(--border); background:var(--surface2); color:var(--muted); font-size:13px; font-weight:700; display:flex; align-items:center; justify-content:center; margin:0 auto 6px; position:relative; z-index:1; transition:all .2s; }
  .wizard-step.active .ws-circle  { border-color:var(--accent); background:var(--accent); color:#fff; }
  .wizard-step.done   .ws-circle  { border-color:var(--green);  background:var(--green);  color:#fff; }
  .ws-label { font-size:12px; color:var(--muted); }
  .wizard-step.active .ws-label { color:var(--text); font-weight:600; }
  .wizard-panel { display:none; }
  .wizard-panel.active { display:block; }
  .provider-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-bottom:4px; }
  .provider-card { background:var(--surface2); border:2px solid var(--border); border-radius:10px; padding:16px 10px; text-align:center; cursor:pointer; transition:all .2s; }
  .provider-card:hover { border-color:var(--accent); }
  .provider-card.selected { border-color:var(--accent); background:rgba(79,110,247,.08); }
  .provider-icon { font-size:28px; margin-bottom:6px; }
  .provider-name { font-size:13px; font-weight:600; }

  /* SETTINGS */
  .settings-nav-item { padding:11px 16px; font-size:13px; font-weight:500; cursor:pointer; color:var(--text2); transition:all .15s; border-left:2px solid transparent; }
  .settings-nav-item:hover { background:var(--surface2); color:var(--text); }
  .settings-nav-item.active { background:rgba(91,115,248,.1); color:var(--accent); border-left-color:var(--accent); }
  .settings-section { display:none; }
  .settings-section.active { display:block; }
  .settings-card { background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:24px; margin-bottom:20px; }
  .settings-card-header { display:flex; gap:16px; align-items:flex-start; margin-bottom:20px; }
  .settings-card-icon { width:44px; height:44px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:22px; flex-shrink:0; }
  .settings-card-title { font-size:16px; font-weight:700; margin-bottom:4px; }
  .settings-card-subtitle { font-size:13px; color:var(--text2); line-height:1.6; }
  .settings-info-box { background:var(--surface2); border:1px solid var(--border2); border-radius:10px; padding:14px 16px; margin-bottom:18px; }
  .settings-info-title { font-size:12px; font-weight:700; color:var(--text2); text-transform:uppercase; letter-spacing:.5px; margin-bottom:6px; }
  .settings-info-text { font-size:13px; color:var(--text2); line-height:1.7; }
  .settings-steps { margin-bottom:18px; display:flex; flex-direction:column; gap:10px; }
  .settings-step { display:flex; align-items:flex-start; gap:12px; font-size:13px; color:var(--text2); line-height:1.6; }
  .settings-step-num { width:22px; height:22px; border-radius:50%; background:var(--accent); color:#fff; font-size:12px; font-weight:700; display:flex; align-items:center; justify-content:center; flex-shrink:0; margin-top:1px; }
  .settings-field-hint { font-size:11px; color:var(--muted); margin-top:5px; line-height:1.5; }
  .settings-status-line { font-size:13px; margin-top:10px; min-height:18px; }
  .settings-toggle-row { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:14px 16px; background:var(--surface2); border-radius:10px; margin-bottom:16px; }
  @media (max-width:700px) {
    .page#page-settings > div { grid-template-columns:1fr !important; }
    .settings-nav-item { display:inline-flex; border-left:none; border-bottom:2px solid transparent; }
    .settings-section { display:none !important; }
    .settings-section.active { display:block !important; }
  }

  /* DORMANTS */
  .dormant-banner { background:rgba(124,58,237,.08); border:1px solid rgba(124,58,237,.25); border-radius:10px; padding:16px 20px; margin-bottom:20px; display:none; }
  .dormant-banner.show { display:block; }
  .dormant-banner-header { display:flex; align-items:center; gap:12px; margin-bottom:12px; }
  .dormant-banner-title { font-size:15px; font-weight:700; flex:1; }
  .dormant-badge { background:rgba(124,58,237,.18); color:#a78bfa; font-size:12px; font-weight:700; padding:2px 10px; border-radius:99px; }
  .dormant-list { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
  .dormant-chip { display:flex; align-items:center; gap:6px; background:var(--surface2); border:1px solid var(--border); border-radius:99px; padding:4px 12px; font-size:13px; }
  .dormant-chip-days { font-size:11px; color:#a78bfa; font-weight:700; }

  /* AI GENERATE */
  .ai-gen-bar { display:flex; align-items:center; gap:8px; margin-bottom:10px; }
  .btn-ai { background:linear-gradient(135deg,#6366f1,#8b5cf6); color:#fff; border:none; border-radius:8px; padding:7px 16px; font-size:13px; font-weight:600; cursor:pointer; display:flex; align-items:center; gap:6px; transition:opacity .2s; flex-shrink:0; }
  .btn-ai:hover { opacity:.88; }
  .btn-ai:disabled { opacity:.5; cursor:not-allowed; }
  .ai-spinner { width:14px; height:14px; border:2px solid rgba(255,255,255,.3); border-top-color:#fff; border-radius:50%; animation:spin .6s linear infinite; flex-shrink:0; }
  @keyframes spin { to { transform:rotate(360deg); } }
  .ai-gen-hint { font-size:12px; color:var(--muted); }
  .ai-gen-result-bar { display:none; align-items:center; gap:8px; margin-top:6px; }
  .ai-gen-result-bar.show { display:flex; }

  /* AUTO-RELANCE */
  .relance-auto-box { background:var(--surface2); border:1px solid var(--border); border-radius:8px; padding:10px 13px; display:flex; align-items:center; gap:10px; }
  .relance-auto-date { font-size:14px; font-weight:600; color:var(--accent); flex:1; }
  .relance-auto-label { font-size:12px; color:var(--muted); margin-bottom:3px; }
  .relance-override { display:none; margin-top:8px; }
  .relance-override.show { display:block; }
  .btn-override { background:none; border:none; color:var(--muted); cursor:pointer; font-size:14px; padding:2px 5px; border-radius:4px; transition:color .15s; }
  .btn-override:hover { color:var(--accent); }
  .rdv-date-row { margin-top:8px; display:none; }
  .rdv-date-row.show { display:block; }

  /* MATCHING */
  .match-badge { display:inline-flex; align-items:center; gap:4px; padding:3px 10px; border-radius:99px; font-size:12px; font-weight:700; cursor:pointer; transition:opacity .2s; }
  .match-badge:hover { opacity:.8; }
  .match-badge-on  { background:rgba(79,110,247,.18); color:var(--accent); border:1px solid rgba(79,110,247,.3); }
  .match-badge-off { background:var(--surface2); color:var(--muted); border:1px solid var(--border); }
  .match-prospect-row { display:flex; align-items:center; gap:12px; padding:11px 0; border-bottom:1px solid var(--border); }
  .match-prospect-row:last-child { border-bottom:none; }
  .match-compat-bar { display:flex; gap:4px; margin-top:3px; }
  .compat-chip { font-size:11px; padding:1px 7px; border-radius:99px; font-weight:600; }
  .compat-zone   { background:rgba(16,185,129,.12); color:var(--green); }
  .compat-budget { background:rgba(79,110,247,.12); color:var(--accent); }
  .compat-type   { background:rgba(124,58,237,.12); color:#a78bfa; }

  /* SCORE */
  .score-bar-wrap { display:flex; align-items:center; gap:7px; }
  .score-bar { width:52px; height:5px; border-radius:99px; background:var(--border); overflow:hidden; flex-shrink:0; }
  .score-fill { height:100%; border-radius:99px; transition:width .4s; }
  .score-num { font-size:12px; font-weight:700; min-width:26px; text-align:right; }
  .score-high   { color:#ef4444; }
  .score-medium { color:#f59e0b; }
  .score-low    { color:var(--muted); }
  .kcard-score { display:flex; align-items:center; gap:5px; margin-top:7px; }
  .kcard-score-bar { flex:1; height:3px; border-radius:99px; background:var(--border); overflow:hidden; }
  .kcard-score-fill { height:100%; border-radius:99px; }
  /* Score pill lisible */
  .score-pill { display:inline-flex; align-items:center; padding:2px 9px; border-radius:99px; font-size:12px; font-weight:600; cursor:default; white-space:nowrap; }
  .score-pill-urgent { background:rgba(239,68,68,.15);  color:#ef4444; }
  .score-pill-medium { background:rgba(245,158,11,.15); color:#f59e0b; }
  .score-pill-low    { background:var(--surface2);      color:var(--muted); }

  /* AUJOURD'HUI */
  .today-hero { display:flex; align-items:center; justify-content:space-between; margin-bottom:24px; }
  .today-counter { background:var(--accent); color:#fff; border-radius:12px; padding:14px 24px; text-align:center; min-width:140px; }
  .today-counter-num { font-size:36px; font-weight:800; line-height:1; }
  .today-counter-label { font-size:12px; margin-top:4px; opacity:.85; }
  .today-section { margin-bottom:28px; }
  .today-section-title { font-size:13px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.6px; margin-bottom:12px; display:flex; align-items:center; gap:8px; }
  .today-section-title .count-chip { background:var(--surface2); border:1px solid var(--border); border-radius:99px; padding:1px 9px; font-size:12px; color:var(--text); font-weight:600; text-transform:none; letter-spacing:0; }
  .today-row { display:flex; align-items:center; gap:12px; background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:13px 16px; margin-bottom:8px; transition:border-color .2s; }
  .today-row:hover { border-color:var(--accent); }
  .today-row.urgent { border-left:3px solid var(--red); }
  .today-row.warn   { border-left:3px solid var(--yellow); }
  .today-row.ok     { border-left:3px solid var(--green); }
  .today-row-info   { flex:1; min-width:0; }
  .today-row-name   { font-size:14px; font-weight:600; margin-bottom:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .today-row-meta   { font-size:12px; color:var(--muted); }
  .today-row-badge  { font-size:11px; font-weight:700; padding:3px 9px; border-radius:99px; flex-shrink:0; }
  .badge-overdue  { background:rgba(239,68,68,.15); color:var(--red); }
  .badge-today    { background:rgba(245,158,11,.15); color:var(--yellow); }
  .badge-pending  { background:rgba(79,110,247,.15); color:var(--accent); }
  .badge-rdv      { background:rgba(124,58,237,.15); color:#a78bfa; }
  .today-actions  { display:flex; gap:6px; flex-shrink:0; }
  .btn-call  { background:rgba(16,185,129,.15); color:var(--green); border:1px solid rgba(16,185,129,.3); }
  .btn-call:hover { background:rgba(16,185,129,.28); }
  .btn-done  { background:rgba(79,110,247,.12); color:var(--accent); border:1px solid rgba(79,110,247,.3); }
  .btn-done:hover { background:rgba(79,110,247,.22); }
  .today-empty { text-align:center; padding:22px; color:var(--muted); font-size:13px; background:var(--surface2); border-radius:10px; }
  .today-date-label { font-size:14px; color:var(--muted); }
  .pulse { animation:pulse 2s infinite; }
  @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.55} }

  /* AI AGENTS */
  .ai-agent-card { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:18px; margin-bottom:12px; transition:border-color .2s; }
  .ai-agent-card:hover { border-color:var(--accent); }
  .ai-agent-header { display:flex; align-items:center; gap:12px; margin-bottom:12px; }
  .ai-avatar { width:40px; height:40px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:15px; flex-shrink:0; }
  .ai-name { font-size:15px; font-weight:600; }
  .ai-meta { font-size:12px; color:var(--muted); margin-top:2px; }
  .ai-stage-track { display:flex; align-items:center; gap:6px; margin-bottom:12px; flex-wrap:wrap; }
  .ai-stage-pill { padding:3px 10px; border-radius:99px; font-size:12px; font-weight:500; background:var(--surface2); border:1px solid var(--border); color:var(--muted); }
  .ai-stage-pill.current { background:rgba(79,110,247,.15); border-color:var(--accent); color:var(--text); font-weight:700; }
  .ai-stage-pill.done { background:rgba(16,185,129,.1); border-color:var(--green); color:var(--green); }
  .ai-stage-arrow { color:var(--border); font-size:12px; }
  .ai-analysis { background:var(--surface2); border-radius:8px; padding:12px 14px; font-size:13px; line-height:1.7; border-left:3px solid var(--accent); margin-bottom:12px; }
  .ai-analysis-label { font-size:11px; font-weight:700; color:var(--accent); text-transform:uppercase; letter-spacing:.5px; margin-bottom:5px; display:flex; align-items:center; gap:5px; }
  .ai-actions { display:flex; gap:8px; flex-wrap:wrap; }
  .ai-thinking { display:inline-block; }
  .ai-thinking span { animation:blink 1.2s infinite; opacity:0; }
  .ai-thinking span:nth-child(1){ animation-delay:0s; }
  .ai-thinking span:nth-child(2){ animation-delay:.3s; }
  .ai-thinking span:nth-child(3){ animation-delay:.6s; }
  @keyframes blink { 0%,80%,100%{opacity:0} 40%{opacity:1} }
  .ai-score { display:flex; align-items:center; gap:6px; margin-left:auto; }
  .ai-score-bar { width:60px; height:6px; border-radius:99px; background:var(--border); overflow:hidden; }
  .ai-score-fill { height:100%; border-radius:99px; background:var(--green); transition:width .5s; }

  /* AUTOMATIONS */
  .auto-email-row { background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:16px; margin-bottom:12px; transition:border-color .2s; }
  .auto-email-row.active-rule { border-color:rgba(79,110,247,.4); }
  .auto-rule-header { display:flex; align-items:center; gap:12px; margin-bottom:12px; }
  .auto-trigger { flex:1; }
  .auto-trigger-label { font-size:12px; color:var(--muted); margin-bottom:3px; }
  .auto-trigger-value { font-size:14px; font-weight:600; display:flex; align-items:center; gap:6px; }
  .sequence-list { border-top:1px solid var(--border); padding-top:12px; display:flex; flex-direction:column; gap:8px; }
  .seq-step { display:flex; align-items:center; gap:8px; background:var(--surface2); border-radius:8px; padding:8px 10px; }
  .seq-step-num { font-size:11px; font-weight:700; color:var(--muted); min-width:18px; }
  .seq-delay-input { width:58px; background:var(--surface); border:1px solid var(--border); color:var(--text); padding:5px 8px; border-radius:6px; font-size:13px; text-align:center; outline:none; }
  .seq-delay-input:focus { border-color:var(--accent); }
  .seq-day-label { font-size:12px; color:var(--muted); flex-shrink:0; }
  .auto-tpl-select { flex:1; background:var(--surface); border:1px solid var(--border); color:var(--text); padding:6px 8px; border-radius:6px; font-size:13px; outline:none; }
  .auto-tpl-select:focus { border-color:var(--accent); }
  .seq-remove { background:none; border:none; color:var(--muted); cursor:pointer; font-size:14px; padding:2px 5px; border-radius:4px; }
  .seq-remove:hover { color:var(--red); }
  .seq-add-btn { font-size:12px; color:var(--accent); background:none; border:1px dashed rgba(79,110,247,.4); border-radius:6px; padding:5px 12px; cursor:pointer; width:100%; transition:background .15s; }
  .seq-add-btn:hover { background:rgba(79,110,247,.07); }
  .seq-add-btn:disabled { opacity:.4; cursor:not-allowed; }
  .auto-log-entry { font-size:13px; padding:8px 0; border-bottom:1px solid var(--border); display:flex; gap:10px; align-items:flex-start; }
  .auto-log-entry:last-child { border-bottom:none; }
  .auto-log-time { color:var(--muted); min-width:130px; flex-shrink:0; font-size:12px; }
  .auto-log-status { flex-shrink:0; }
  .queue-section { margin-top:24px; }
  .queue-row { display:flex; align-items:center; gap:10px; padding:9px 12px; background:var(--surface); border:1px solid var(--border); border-radius:8px; margin-bottom:6px; font-size:13px; }
  .queue-row.sent  { opacity:.5; }
  .queue-row.cancelled { opacity:.4; text-decoration:line-through; }

  /* PIPELINE EDITOR */
  .pipeline-editor-btn { margin-left: auto; }
  .stage-editor-list { margin-bottom: 16px; }
  .stage-editor-row { display: flex; align-items: center; gap: 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; cursor: grab; transition: box-shadow .2s; }
  .stage-editor-row:hover { box-shadow: 0 0 0 1px var(--accent); }
  .stage-drag-handle { color: var(--muted); font-size: 16px; cursor: grab; flex-shrink: 0; }
  .stage-color-dot { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; cursor: pointer; border: 2px solid transparent; transition: border-color .2s; }
  .stage-color-dot:hover { border-color: #fff; }
  .stage-name-input { flex: 1; background: transparent; border: none; color: var(--text); font-size: 14px; font-weight: 500; outline: none; }
  .stage-name-input:focus { border-bottom: 1px solid var(--accent); }
  .stage-delete-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 4px; transition: color .2s; flex-shrink: 0; }
  .stage-delete-btn:hover { color: var(--red); }
  .stage-final-badge { font-size: 11px; color: var(--green); background: rgba(16,185,129,.12); padding: 2px 8px; border-radius: 99px; flex-shrink: 0; }
  .color-palette { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 14px; }
  .color-swatch { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: border-color .15s, transform .15s; }
  .color-swatch:hover { transform: scale(1.2); border-color: #fff; }
  .color-swatch.selected { border-color: #fff; transform: scale(1.15); }
  .add-stage-row { display: flex; gap: 8px; }

  /* EMAILS PAGE */
  .email-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
  .email-sidebar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
  .email-sidebar-header { padding: 12px 16px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: .5px; }
  .email-tpl-item { padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background .15s; }
  .email-tpl-item:last-child { border-bottom: none; }
  .email-tpl-item:hover { background: var(--surface2); }
  .email-tpl-item.active { background: rgba(79,110,247,.12); border-left: 3px solid var(--accent); }
  .email-tpl-name { font-size: 14px; font-weight: 500; margin-bottom: 3px; }
  .email-tpl-stage { font-size: 12px; color: var(--muted); }
  .email-main { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
  .email-main-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
  .email-main-title { font-size: 17px; font-weight: 700; }
  .email-field { margin-bottom: 14px; }
  .email-field label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; display: block; margin-bottom: 5px; }
  .email-subject { font-size: 15px; font-weight: 600; background: var(--surface2); border: 1px solid var(--border); border-radius: 7px; padding: 10px 14px; width: 100%; color: var(--text); outline: none; }
  .email-subject:focus { border-color: var(--accent); }
  .email-body-area { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 7px; padding: 14px; color: var(--text); font-size: 14px; line-height: 1.7; outline: none; resize: vertical; min-height: 220px; font-family: inherit; }
  .email-body-area:focus { border-color: var(--accent); }
  .vars-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
  .var-chip { padding: 3px 10px; border-radius: 99px; font-size: 12px; background: var(--surface2); border: 1px solid var(--border); cursor: pointer; color: var(--accent); font-family: monospace; transition: background .15s; }
  .var-chip:hover { background: rgba(79,110,247,.15); }
  .email-preview { background: #fff; color: #111; border-radius: 8px; padding: 24px; font-size: 14px; line-height: 1.8; margin-top: 16px; display: none; white-space: pre-wrap; }
  .email-preview.show { display: block; }
  .prospect-selector { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 7px; font-size: 14px; outline: none; width: 100%; }
  .send-bar { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; align-items: center; }
  .email-sent-log { margin-top: 20px; }
  .sent-entry { font-size: 13px; padding: 7px 0; border-bottom: 1px solid var(--border); color: var(--muted); display: flex; gap: 10px; }
  .sent-entry:last-child { border-bottom: none; }
  .sent-entry strong { color: var(--text); }

  /* NOTIF POPUP */
  .notif-popup { position: fixed; top: 70px; right: 20px; width: 320px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; z-index: 300; box-shadow: 0 8px 32px rgba(0,0,0,.5); transform: translateX(360px); transition: transform .3s; }
  .notif-popup.show { transform: translateX(0); }
  .notif-popup-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-weight: 600; }
  .notif-item { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
  .notif-item:last-child { border-bottom: none; }
  .notif-item strong { display: block; margin-bottom: 2px; }

  @media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .kanban { grid-template-columns: repeat(2, 1fr); }
    .biens-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-grid { grid-template-columns: 1fr; }
  }

  /* ── MOBILE < 640px ──────────────────────────────────────── */
  /* ── AUTH SCREENS ─────────────────────────────────────────── */
  .auth-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
  }
  .auth-card {
    background: var(--surface); border: 1px solid var(--border2);
    border-radius: 18px; width: 100%; max-width: 420px;
    box-shadow: 0 24px 60px rgba(0,0,0,.55); overflow: hidden;
  }
  .auth-card-body { padding: 40px 36px 28px; }
  .auth-logo { font-size: 28px; font-weight: 800; color: var(--accent); letter-spacing: -1px; margin-bottom: 4px; }
  .auth-tagline { font-size: 13px; color: var(--muted); margin-bottom: 28px; line-height: 1.6; }
  .auth-title { font-size: 18px; font-weight: 700; margin-bottom: 5px; letter-spacing: -.3px; }
  .auth-sub { font-size: 13px; color: var(--text2); margin-bottom: 22px; line-height: 1.6; }
  .btn-google {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; padding: 13px; border-radius: 10px; font-size: 15px; font-weight: 600;
    background: #fff; color: #1f1f1f; border: none; cursor: pointer;
    transition: opacity .15s; box-shadow: 0 1px 6px rgba(0,0,0,.25);
  }
  .btn-google:hover { opacity: .9; }
  .btn-google:disabled { opacity: .55; cursor: not-allowed; }
  .google-icon { width: 20px; height: 20px; flex-shrink: 0; }
  .auth-status { min-height: 20px; font-size: 13px; margin-top: 14px; text-align: center; }
  .auth-footer {
    padding: 14px 36px 20px; border-top: 1px solid var(--border);
    display: flex; justify-content: center;
  }
  .auth-footer-link {
    font-size: 12px; color: var(--muted); cursor: pointer;
    transition: color .15s; background: none; border: none;
  }
  .auth-footer-link:hover { color: var(--accent); }
  .auth-loading { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 10px; }
  .auth-spinner {
    width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
    border: 2px solid var(--border2); border-top-color: var(--accent);
    animation: spin .7s linear infinite;
  }
  .auth-user-chip {
    display: flex; align-items: center; gap: 7px;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 99px; padding: 3px 10px 3px 3px;
    font-size: 12px; color: var(--text2);
  }
  .auth-user-avatar {
    width: 22px; height: 22px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
  }
  .btn-logout {
    background: none; border: none; color: var(--muted);
    font-size: 11px; cursor: pointer; padding: 2px 5px;
    border-radius: 4px; transition: color .15s; line-height: 1;
  }
  .btn-logout:hover { color: var(--red); }

  /* ── AGENCY ──────────────────────────────────────────────── */
  .agency-tab-panel { animation: fadeIn .15s; }
  @keyframes fadeIn { from { opacity:0; transform:translateY(4px) } to { opacity:1; transform:none } }
  .invite-code-box {
    background: var(--surface2); border: 1px solid var(--accent);
    border-radius: 10px; padding: 14px 18px; text-align: center; margin: 12px 0;
  }
  .invite-code-val {
    font-size: 28px; font-weight: 800; letter-spacing: 6px; color: var(--accent);
    font-family: monospace;
  }
  .invite-code-hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
  .member-row {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 0; border-bottom: 1px solid var(--border);
    font-size: 13px;
  }
  .member-row:last-child { border-bottom: none; }
  .member-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
  }
  .member-name { flex: 1; font-weight: 500; }
  .member-role { font-size: 11px; padding: 2px 8px; border-radius: 99px; font-weight: 600; }
  .role-owner { background: rgba(91,115,248,.15); color: var(--accent); }
  .role-agent { background: var(--surface2); color: var(--muted); }
  .assignee-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; color: var(--text2);
  }
  .assignee-dot {
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  }
  /* ── Global search ── */
  .nav-search-btn {
    display: flex; align-items: center; gap: 7px;
    padding: 5px 11px; border-radius: 8px; cursor: pointer;
    font-size: 13px; color: var(--muted); border: 1px solid var(--border);
    background: var(--surface2); transition: all .15s; white-space: nowrap;
  }
  .nav-search-btn:hover { color: var(--text2); border-color: var(--accent); }
  .nav-search-btn kbd { font-size: 11px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-family: inherit; }

  .search-modal {
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    width: 560px; max-width: calc(100vw - 32px);
    box-shadow: 0 24px 64px rgba(0,0,0,.35);
    overflow: hidden; margin-top: 80px;
  }
  .search-input-wrap {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px; border-bottom: 1px solid var(--border);
  }
  #search-input {
    flex: 1; border: none; background: transparent; font-size: 16px;
    color: var(--text); outline: none;
  }
  #search-input::placeholder { color: var(--muted); }
  .search-esc { font-size: 11px; color: var(--muted); background: var(--surface2); border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px; cursor: pointer; font-family: inherit; }
  #search-results { max-height: 380px; overflow-y: auto; padding: 6px; }
  .search-result {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 8px; cursor: pointer; transition: background .1s;
  }
  .search-result:hover, .search-result.active { background: var(--surface2); }
  .search-result-avatar {
    width: 34px; height: 34px; border-radius: 50%; background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
  }
  .search-result-name { font-weight: 600; font-size: 14px; color: var(--text); }
  .search-result-meta { font-size: 12px; color: var(--muted); margin-top: 1px; }
  .search-empty { text-align: center; padding: 32px 16px; color: var(--muted); font-size: 14px; }

  /* ── CSV import ── */
  .csv-drop-zone {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding: 32px 20px; border: 2px dashed var(--border); border-radius: 12px;
    cursor: pointer; transition: all .15s; color: var(--muted); font-size: 14px; text-align: center;
  }
  .csv-drop-zone:hover, .csv-drop-zone.drag-over { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
  .csv-map-title {
    font-size: 13px; font-weight: 600; color: var(--text2);
    margin-bottom: 10px;
  }
  .csv-map-cards { display: flex; flex-direction: column; gap: 8px; }
  .csv-map-card {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 12px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface); transition: border-color .15s;
  }
  .csv-map-card.is-mapped { border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
  .csv-map-card-left { flex: 1; min-width: 0; }
  .csv-map-col-name {
    font-size: 13px; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: block; margin-bottom: 2px;
  }
  .csv-map-col-preview {
    font-size: 12px; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .csv-map-select {
    flex: 0 0 200px; padding: 6px 10px; border-radius: 7px;
    border: 1px solid var(--border); background: var(--surface2);
    color: var(--text); font-size: 13px; transition: border-color .15s;
  }
  .csv-map-card.is-mapped .csv-map-select { border-color: var(--accent); }

  .agency-chip-nav {
    display: flex; align-items: center; gap: 5px;
    font-size: 12px; color: var(--muted);
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 99px; padding: 3px 9px; cursor: pointer;
    transition: border-color .15s;
  }
  .agency-chip-nav:hover { border-color: var(--accent); color: var(--text); }

  /* ── SYNC BADGE (bottom-right) ───────────────────────────── */
  #sync-badge {
    position: fixed; bottom: 14px; right: 16px; z-index: 400;
    display: flex; align-items: center; gap: 5px;
    font-size: 12px; font-weight: 600; padding: 5px 10px;
    border-radius: 99px; border: 1px solid var(--border);
    background: var(--surface); color: var(--muted);
    cursor: default; user-select: none;
    transition: opacity .3s, border-color .3s;
    opacity: .7;
  }
  #sync-badge:hover { opacity: 1; }
  #sync-badge.synced { border-color: rgba(16,185,129,.4); color: var(--green); }
  #sync-badge.syncing { border-color: rgba(91,115,248,.4); color: var(--accent); }
  #sync-badge.local  { border-color: rgba(245,158,11,.4);  color: var(--yellow); }
  #sync-badge.error  { border-color: rgba(239,68,68,.4);   color: var(--red); }
  @media (max-width: 640px) { #sync-badge { bottom: 72px; } }

  /* ── VIEW TOGGLE (Liste / Kanban) ───────────────────────── */
  .view-toggle { display:flex; background:var(--surface2); border:1px solid var(--border); border-radius:7px; overflow:hidden; }
  .view-toggle-btn { background:none; border:none; color:var(--muted); padding:6px 13px; font-size:13px; font-weight:500; cursor:pointer; transition:all .15s; white-space:nowrap; }
  .view-toggle-btn.active { background:var(--accent); color:#fff; }
  .view-toggle-btn:hover:not(.active) { color:var(--text); background:var(--surface3); }

  @media (max-width: 640px) {

    /* Hide top nav, show bottom nav */
    nav { display: none !important; }
    body { padding-bottom: 70px; }

    /* Bottom navigation */
    .mobile-nav {
      display: flex !important;
      position: fixed; bottom: 0; left: 0; right: 0; z-index: 500;
      background: var(--surface); border-top: 1px solid var(--border);
      height: 62px; align-items: stretch;
    }
    .mobile-nav-btn {
      flex: 1; display: flex; flex-direction: column; align-items: center;
      justify-content: center; gap: 3px; background: none; border: none;
      color: var(--muted); font-size: 20px; cursor: pointer;
      transition: color .15s; padding: 0; position: relative;
    }
    .mobile-nav-btn.active { color: var(--accent); }
    .mobile-nav-btn span { font-size: 10px; font-weight: 600; letter-spacing: .3px; }
    .mobile-nav-badge {
      position: absolute; top: 6px; right: calc(50% - 16px);
      background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
      padding: 1px 5px; border-radius: 99px; min-width: 16px; text-align: center;
    }

    /* Page padding */
    .page { padding: 16px 14px 0; }

    /* Today page — mobile cards */
    .today-hero { flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
    .today-counter { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-radius: 10px; }
    .today-counter-num { font-size: 28px; }
    .today-counter-label { font-size: 13px; opacity: .9; }
    .today-section-title { font-size: 12px; margin-bottom: 10px; }

    /* Swipe card container */
    .today-swipe-wrap {
      overflow: hidden; border-radius: 12px; margin-bottom: 10px;
      position: relative;
    }
    /* Hint labels behind the card */
    .swipe-hint-done {
      position: absolute; left: 0; top: 0; bottom: 0; width: 80px;
      background: var(--green); display: flex; align-items: center;
      justify-content: center; font-size: 22px; border-radius: 12px 0 0 12px;
    }
    .swipe-hint-snooze {
      position: absolute; right: 0; top: 0; bottom: 0; width: 80px;
      background: var(--yellow); display: flex; align-items: center;
      justify-content: center; font-size: 22px; border-radius: 0 12px 12px 0;
    }

    /* Mobile card (replaces today-row on mobile) */
    .today-mobile-card {
      background: var(--surface); border: 1px solid var(--border);
      border-radius: 12px; padding: 16px;
      position: relative; z-index: 1;
      transition: transform .25s cubic-bezier(.4,0,.2,1), opacity .25s;
      will-change: transform;
      touch-action: pan-y;
    }
    .today-mobile-card.urgent { border-left: 4px solid var(--red); }
    .today-mobile-card.warn   { border-left: 4px solid var(--yellow); }
    .today-mobile-card.ok     { border-left: 4px solid var(--green); }
    .today-mobile-card.swipe-out-done   { transform: translateX(110%); opacity: 0; }
    .today-mobile-card.swipe-out-snooze { transform: translateX(-110%); opacity: 0; }

    .mob-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
    .mob-card-avatar {
      width: 42px; height: 42px; border-radius: 50%; display: flex;
      align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0;
    }
    .mob-card-name { font-size: 18px; font-weight: 700; line-height: 1.1; }
    .mob-card-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
    .mob-card-badge-row { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
    .mob-card-btns { display: flex; flex-direction: column; gap: 8px; }
    .mob-btn-call {
      display: flex; align-items: center; justify-content: center; gap: 8px;
      width: 100%; padding: 13px; border-radius: 10px; font-size: 15px; font-weight: 700;
      background: var(--green); color: #fff; text-decoration: none; border: none; cursor: pointer;
      transition: opacity .15s;
    }
    .mob-btn-call:hover { opacity: .88; }
    .mob-btn-done {
      display: flex; align-items: center; justify-content: center; gap: 8px;
      width: 100%; padding: 12px; border-radius: 10px; font-size: 14px; font-weight: 600;
      background: var(--surface2); color: var(--text); border: 1px solid var(--border); cursor: pointer;
      transition: background .15s;
    }
    .mob-btn-done:hover { background: rgba(79,110,247,.1); border-color: var(--accent); color: var(--accent); }
    .mob-swipe-hint { text-align: center; font-size: 11px; color: var(--muted); margin-top: 6px; }

    /* Today empty state */
    .today-empty { padding: 28px 0; font-size: 14px; }

    /* Notif-tab — repositionné en bas à droite au-dessus de la nav mobile */
    #notif-tab {
      top: auto !important;
      bottom: 130px !important;
      transform: none !important;
      padding: 8px 5px !important;
      font-size: 11px !important;
      border-radius: 6px 0 0 6px !important;
      max-width: 50px !important;
    }

    /* Prospects — mobile cards (visibility gérée par renderCRM() en JS) */
    #crm-cards { flex-direction: column; gap: 10px; }

    .prospect-card {
      background: var(--surface); border: 1px solid var(--border);
      border-radius: 12px; padding: 14px 14px 12px; cursor: pointer;
      display: flex; flex-direction: column; gap: 10px;
      transition: box-shadow .15s;
    }
    .prospect-card:active { opacity: .85; }
    .pcard-top {
      display: flex; align-items: center;
      justify-content: space-between; gap: 10px;
    }
    .pcard-name-block { display: flex; align-items: center; gap: 9px; min-width: 0; }
    .pcard-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .pcard-signed { font-size: 10px; background: rgba(16,185,129,.18); color: var(--green); padding: 1px 6px; border-radius: 99px; font-weight: 700; white-space: nowrap; }
    .pcard-mid {
      display: flex; align-items: center;
      justify-content: space-between; font-size: 14px;
    }
    .pcard-tel { color: var(--text2); }
    .pcard-budget { font-weight: 700; color: var(--text); }
    .pcard-status-row {
      display: flex; align-items: center;
      justify-content: space-between; flex-wrap: wrap; gap: 6px;
    }
    .pcard-status { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text2); }
    .pcard-actions { display: flex; gap: 8px; }
    .pcard-actions .btn { flex: 1; justify-content: center; font-size: 13px; }
  }

  /* Hide bottom nav on desktop */
  .mobile-nav { display: none; }

  /* Cards masquées par défaut — le JS dans renderCRM() gère display selon window.innerWidth */
  #crm-cards { display: none; }

  /* ONBOARDING */
  .onboarding-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,.75); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
  }
  .onboarding-box {
    background: var(--surface); border: 1px solid var(--border2);
    border-radius: 18px; width: 480px; max-width: 100%;
    box-shadow: 0 24px 60px rgba(0,0,0,.6);
    overflow: hidden;
  }
  .onboarding-progress {
    height: 3px; background: var(--border);
  }
  .onboarding-progress-fill {
    height: 100%; background: var(--accent);
    transition: width .4s cubic-bezier(.4,0,.2,1);
    border-radius: 0 99px 99px 0;
  }
  .onboarding-body { padding: 32px 32px 24px; }
  .onboarding-step-label {
    font-size: 11px; font-weight: 700; color: var(--accent);
    text-transform: uppercase; letter-spacing: .7px; margin-bottom: 10px;
  }
  .onboarding-title { font-size: 22px; font-weight: 800; margin-bottom: 8px; letter-spacing: -.3px; }
  .onboarding-desc { font-size: 14px; color: var(--text2); line-height: 1.7; margin-bottom: 24px; }
  .onboarding-content { margin-bottom: 24px; }
  .onboarding-footer { display: flex; align-items: center; justify-content: space-between; padding: 16px 32px 24px; border-top: 1px solid var(--border); }
  .onboarding-skip { font-size: 13px; color: var(--muted); cursor: pointer; background: none; border: none; transition: color .15s; }
  .onboarding-skip:hover { color: var(--text2); }
  .onboarding-dots { display: flex; gap: 6px; align-items: center; }
  .onboarding-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border2); transition: all .2s; }
  .onboarding-dot.active { background: var(--accent); transform: scale(1.25); }
  .onboarding-dot.done { background: var(--green); }
  .ob-field-label { font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
  .ob-input { width: 100%; background: var(--surface2); border: 1px solid var(--border2); color: var(--text); padding: 12px 14px; border-radius: 9px; font-size: 15px; outline: none; transition: border-color .15s; }
  .ob-input:focus { border-color: var(--accent); }
  .ob-hint { font-size: 12px; color: var(--muted); margin-top: 7px; }
  .ob-icon { font-size: 40px; margin-bottom: 12px; }
  .ob-feature-list { display: flex; flex-direction: column; gap: 10px; }
  .ob-feature { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--text2); line-height: 1.5; }
  .ob-feature-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
  .ob-email-status { font-size: 13px; min-height: 20px; margin-top: 8px; }



/* ── RGPD ──────────────────────────────────────────────────────── */
.rgpd-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 28px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 40;
}
.rgpd-footer a {
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  transition: color .15s;
}
.rgpd-footer a:hover { color: var(--text2); text-decoration: underline; }

#rgpd-banner {
  position: fixed;
  bottom: 28px;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 2px solid var(--accent);
  padding: 16px 20px;
  display: none;
  align-items: center;
  gap: 16px;
  z-index: 80;
  box-shadow: 0 -6px 24px rgba(0,0,0,0.45);
}
.rgpd-banner-text {
  flex: 1;
  font-size: 13px;
  color: var(--text2);
  line-height: 1.4;
}
.rgpd-banner-btns { display: flex; gap: 8px; flex-shrink: 0; }

/* padding-bottom applied only while banner is visible */
.rgpd-banner-open .page { padding-bottom: 96px; }
/* always leave room for the footer bar */
.page { padding-bottom: 36px; }

/* ── AGENDA ──────────────────────────────────────────────────── */
.generic-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.generic-modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  width: 92vw; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow);
}
.generic-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 0;
}
.generic-modal-title { font-size: 16px; font-weight: 700; }
.generic-modal-close {
  background: none; border: none; cursor: pointer; color: var(--muted);
  font-size: 18px; line-height: 1; padding: 4px 8px; border-radius: 6px;
}
.generic-modal-close:hover { background: var(--surface2); color: var(--text); }
.generic-modal-body { padding: 16px 20px; }
.generic-modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 12px 20px 18px; border-top: 1px solid var(--border);
}

.agenda-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.agenda-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; padding: 0 2px;
}
.agenda-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.agenda-dow {
  background: var(--surface2); padding: 7px 4px; text-align: center;
  font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.agenda-cell {
  background: var(--surface); min-height: 78px; padding: 5px 5px 4px;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .1s;
}
.agenda-cell:hover { background: var(--surface2); }
.agenda-cell:nth-child(7n) { border-right: none; }
.agenda-cell-empty {
  background: var(--surface2); min-height: 78px;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.agenda-cell-empty:nth-child(7n) { border-right: none; }
.agenda-cell-num {
  font-size: 12px; font-weight: 600; margin-bottom: 3px;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.agenda-cell-today .agenda-cell-num {
  background: var(--accent); color: #fff; font-weight: 700;
}
.agenda-chip {
  font-size: 10px; padding: 1px 5px; border-radius: 4px; margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  display: block;
}
.agenda-chip-rdv  { background: rgba(79,110,247,.15); color: var(--accent); }
.agenda-chip-free { background: rgba(16,185,129,.13); color: #10b981; }
.agenda-chip-more { font-size: 10px; color: var(--muted); padding-left: 5px; }

.agenda-list-day {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 10px; padding: 12px 14px; cursor: pointer;
}
.agenda-list-day:hover { background: var(--surface2); }
.agenda-list-day-label {
  font-size: 13px; font-weight: 700; margin-bottom: 8px; text-transform: capitalize;
}
.agenda-list-item {
  display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0;
}
.agenda-item-rdv  { color: var(--accent); }
.agenda-item-free { color: var(--text); }
.agenda-item-time { font-size: 11px; font-weight: 600; color: var(--muted); min-width: 38px; }

.day-modal-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.day-modal-item:last-child { border-bottom: none; }
.day-modal-item-icon { font-size: 20px; flex-shrink: 0; padding-top: 2px; }
.day-modal-item-info { flex: 1; min-width: 0; }
.day-modal-item-title { font-weight: 600; font-size: 14px; }
.day-modal-item-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.day-modal-item-del {
  background: none; border: none; cursor: pointer; color: var(--muted);
  font-size: 15px; padding: 2px 6px; border-radius: 5px; flex-shrink: 0;
  line-height: 1;
}
.day-modal-item-del:hover { background: rgba(239,68,68,.12); color: var(--red); }

/* ── Documents section ─────────────────────────────────────────── */
.doc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.doc-item:last-child { border-bottom: none; }
.doc-info { flex: 1; min-width: 0; overflow: hidden; }
.doc-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.doc-actions { display: flex; gap: 4px; flex-shrink: 0; }
.doc-btn {
  background: none;
  border: 1px solid var(--border2);
  border-radius: 6px;
  cursor: pointer;
  padding: 3px 8px;
  font-size: 13px;
  color: var(--text2);
  line-height: 1.4;
}
.doc-btn:hover { background: var(--surface2); }
.doc-btn-del:hover { background: rgba(239,68,68,.12); color: var(--red); border-color: var(--red); }

/* ── Historique / Interactions timeline ────────────────────────── */
.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-icon { font-size: 17px; flex-shrink: 0; width: 22px; text-align: center; padding-top: 1px; }
.timeline-body { flex: 1; min-width: 0; }
.timeline-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; flex-wrap: wrap; }
.timeline-type { font-size: 12px; font-weight: 700; }
.timeline-date { font-size: 11px; color: var(--muted); }
.timeline-content { font-size: 13px; color: var(--text2); line-height: 1.4; word-break: break-word; }
.timeline-author {
  display: inline-block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted);
  background: var(--surface2);
  border-radius: 4px;
  padding: 1px 6px;
}
.interaction-add-form {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
