/* NELO CRM — Styles */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #F8F8F6;
  --surface: #FFFFFF;
  --border: rgba(0,0,0,0.1);
  --border-md: rgba(0,0,0,0.18);
  --text: #1a1a1a;
  --text-2: #555;
  --text-3: #999;
  --accent: #378ADD;
  --accent-bg: #E6F1FB;
  --accent-text: #0C447C;
  --success: #1D9E75;
  --success-bg: #E1F5EE;
  --warning: #BA7517;
  --warning-bg: #FAEEDA;
  --danger: #A32D2D;
  --danger-bg: #FCEBEB;
  --info-bg: #E6F1FB;
  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-w: 220px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

/* Layout */
.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { width: var(--sidebar-w); background: var(--surface); border-right: 0.5px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 10; }
.sidebar-logo { padding: 18px 16px 14px; border-bottom: 0.5px solid var(--border); }
.logo-text { font-size: 16px; font-weight: 600; color: var(--text); }
.logo-accent { color: var(--accent); }
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section { font-size: 10px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .07em; padding: 6px 16px 3px; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 7px 16px; font-size: 13px; color: var(--text-2); text-decoration: none; border-left: 2px solid transparent; transition: all .12s; }
.nav-item svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; flex-shrink: 0; }
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { color: var(--accent-text); background: var(--accent-bg); border-left-color: var(--accent); font-weight: 500; }
.nav-campaign { font-size: 12px; }
.camp-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.nav-count { margin-left: auto; font-size: 11px; color: var(--text-3); background: var(--bg); padding: 1px 6px; border-radius: 10px; }
.sidebar-footer { padding: 12px 16px; border-top: 0.5px solid var(--border); }
.user-info { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-bg); color: var(--accent-text); font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.user-name { font-size: 12px; font-weight: 500; }
.user-role { font-size: 11px; color: var(--text-3); }
.btn-logout { display: block; text-align: center; font-size: 12px; color: var(--text-3); text-decoration: none; padding: 5px; border: 0.5px solid var(--border); border-radius: var(--radius); }
.btn-logout:hover { background: var(--bg); color: var(--danger); }

/* Main */
.main-content { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }
.page-inner { padding: 24px; }

/* Flash */
.flash { padding: 10px 24px; font-size: 13px; font-weight: 500; }
.flash-success { background: var(--success-bg); color: var(--success); }
.flash-error { background: var(--danger-bg); color: var(--danger); }
.flash-info { background: var(--accent-bg); color: var(--accent-text); }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-title { font-size: 18px; font-weight: 600; }
.page-subtitle { font-size: 13px; color: var(--text-3); margin-top: 2px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; font-size: 13px; font-family: var(--font); border-radius: var(--radius); border: 0.5px solid var(--border-md); background: var(--surface); color: var(--text-2); cursor: pointer; text-decoration: none; transition: all .12s; }
.btn:hover { background: var(--bg); color: var(--text); }
.btn-primary { background: var(--accent); color: #fff; border-color: #185FA5; }
.btn-primary:hover { background: #185FA5; }
.btn-success { background: var(--success); color: #fff; border-color: #0F6E56; }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: #F09595; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-wa { background: #f0fdf4; color: #166534; border-color: #25D366; }
.btn-wa:hover { background: #dcfce7; }
.btn-wa svg { fill: #25D366; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; }
.stat-val { font-size: 24px; font-weight: 600; line-height: 1; }
.stat-lbl { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.stat-card.accent { border-left: 3px solid var(--accent); }
.stat-card.success { border-left: 3px solid var(--success); }
.stat-card.warning { border-left: 3px solid var(--warning); }
.stat-card.danger { border-left: 3px solid var(--danger); }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar-left { display: flex; align-items: center; gap: 8px; flex: 1; }

/* Form controls */
input[type=text], input[type=email], input[type=password], input[type=search],
select, textarea {
  font-size: 13px; font-family: var(--font); padding: 7px 10px;
  border: 0.5px solid var(--border-md); border-radius: var(--radius);
  background: var(--surface); color: var(--text); outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label { font-size: 12px; color: var(--text-2); display: block; margin-bottom: 5px; }
.form-group { margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Table */
.table-wrap { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; padding: 10px 14px; text-align: left; background: var(--bg); border-bottom: 0.5px solid var(--border); }
td { padding: 11px 14px; border-bottom: 0.5px solid var(--border); font-size: 13px; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr { cursor: pointer; transition: background .1s; }
tbody tr:hover td { background: var(--bg); }

/* Avatar */
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-bg); color: var(--accent-text); font-size: 10px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.name-cell { display: flex; align-items: center; gap: 8px; overflow: hidden; }
.name-cell span { overflow: hidden; text-overflow: ellipsis; }

/* Badges */
.badge { display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 10px; font-weight: 500; }
.badge-eval { background: #EAF3DE; color: #3B6D11; }
.badge-attente { background: var(--accent-bg); color: var(--accent-text); }
.badge-relance { background: var(--warning-bg); color: var(--warning); }
.badge-conv { background: var(--success-bg); color: var(--success); }
.badge-perdu { background: var(--danger-bg); color: var(--danger); }
.badge-type { background: var(--bg); color: var(--text-2); border: 0.5px solid var(--border); }

/* Action buttons in table */
.action-cell { display: flex; gap: 4px; }
.icon-btn { width: 27px; height: 27px; border-radius: var(--radius); border: 0.5px solid var(--border); background: var(--surface); display: flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--bg); }
.icon-btn svg { width: 13px; height: 13px; fill: none; stroke: var(--text-2); stroke-width: 1.5; }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 200; overflow-y: auto; padding: 40px 16px; }
.modal-overlay.open { display: flex; align-items: flex-start; justify-content: center; }
.modal { background: var(--surface); border-radius: var(--radius-lg); width: 600px; max-width: 100%; box-shadow: 0 8px 40px rgba(0,0,0,.18); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 0.5px solid var(--border); }
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close { font-size: 20px; cursor: pointer; color: var(--text-3); background: none; border: none; line-height: 1; padding: 0 4px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 18px; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 0.5px solid var(--border); }
.modal-section { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 0.5px solid var(--border); }
.modal-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.section-title { font-size: 12px; font-weight: 600; margin-bottom: 10px; }

/* Email preview */
.email-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.email-tab { font-size: 12px; padding: 5px 14px; border-radius: 20px; border: 0.5px solid var(--border-md); background: transparent; color: var(--text-2); cursor: pointer; }
.email-tab.active { background: var(--bg); color: var(--text); border-color: var(--border-md); font-weight: 500; }
.email-subject { font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.email-subject strong { color: var(--text); }
.email-body-preview { background: var(--bg); border-radius: var(--radius); padding: 12px; font-size: 13px; line-height: 1.7; white-space: pre-wrap; min-height: 140px; border: 0.5px solid var(--border); }

/* Comments */
.comment-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; max-height: 180px; overflow-y: auto; }
.comment-item { background: var(--bg); border-radius: var(--radius); padding: 8px 10px; font-size: 12px; line-height: 1.5; }
.comment-meta { font-size: 10px; color: var(--text-3); margin-top: 3px; }
.comment-input-row { display: flex; gap: 6px; }
.comment-input-row input { flex: 1; }

/* Files */
.file-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.file-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--bg); border-radius: var(--radius); font-size: 12px; }
.file-item a { color: var(--accent-text); text-decoration: none; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item a:hover { text-decoration: underline; }
.file-size { color: var(--text-3); flex-shrink: 0; }

/* Import page */
.import-zone { border: 2px dashed var(--border-md); border-radius: var(--radius-lg); padding: 2rem; text-align: center; cursor: pointer; color: var(--text-2); transition: all .15s; }
.import-zone:hover, .import-zone.dragover { border-color: var(--accent); background: var(--accent-bg); }
.import-zone svg { width: 32px; height: 32px; stroke: var(--text-3); fill: none; margin: 0 auto 10px; display: block; }
.type-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.type-pill { font-size: 12px; padding: 6px 16px; border-radius: 20px; border: 0.5px solid var(--border-md); background: var(--surface); color: var(--text-2); cursor: pointer; }
.type-pill.active { background: var(--accent); color: #fff; border-color: #185FA5; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; width: 380px; }
.login-logo { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 1.5rem; text-align: center; }
.login-logo span { color: var(--accent); }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 4px; justify-content: center; margin-top: 16px; }
.pagination a, .pagination span { padding: 5px 10px; font-size: 13px; border: 0.5px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text-2); }
.pagination a:hover { background: var(--bg); }
.pagination .current { background: var(--accent); color: #fff; border-color: #185FA5; }

/* Card grid */
.card { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
