/* CRM FG Dev — Design System (même charte que EasyForm) */

:root {
  --crm-p1:           #667eea;
  --crm-p2:           #764ba2;
  --crm-grad:         linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --crm-primary:      #667eea;
  --crm-primary-dark: #5a67d8;
  --crm-primary-light:rgba(102,126,234,.1);

  --crm-sidebar-bg:   #12192c;
  --crm-sidebar-w:    258px;
  --crm-topbar-h:     60px;
  --crm-bg:           #f0f2f8;
  --crm-surface:      #ffffff;
  --crm-border:       #e2e8f0;
  --crm-text:         #1a202c;
  --crm-muted:        #718096;

  --crm-success:      #38a169;
  --crm-warning:      #d69e2e;
  --crm-danger:       #e53e3e;

  --crm-radius:       12px;
  --crm-radius-sm:    8px;
  --crm-shadow:       0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  --crm-shadow-md:    0 4px 6px rgba(0,0,0,.07), 0 10px 30px rgba(0,0,0,.08);
  --crm-transition:   all .2s cubic-bezier(.4,0,.2,1);
}

*,*::before,*::after { box-sizing: border-box; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--crm-bg);
  color: var(--crm-text);
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

/* ── SIDEBAR ── */
.crm-sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--crm-sidebar-w); height: 100vh;
  background: var(--crm-sidebar-bg);
  display: flex; flex-direction: column;
  z-index: 1000;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.08) transparent;
}

.crm-sidebar-header {
  display: flex; align-items: center;
  padding: 20px 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}

.crm-logo {
  display: flex; align-items: center; gap: 11px;
  text-decoration: none;
}
.crm-logo-icon {
  width: 36px; height: 36px;
  background: var(--crm-grad);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: #fff;
  box-shadow: 0 4px 12px rgba(102,126,234,.5);
  flex-shrink: 0;
}
.crm-logo-icon i { font-size: 1rem; color: #fff; }
.crm-logo-text { font-size: 1.05rem; font-weight: 800; color: #fff; letter-spacing: -.3px; }
.crm-logo-sub  { display: block; font-size: .63rem; color: rgba(255,255,255,.3); letter-spacing: .3px; }

.crm-nav { list-style: none; margin: 0; padding: 10px 8px; flex: 1; }
.crm-nav-section {
  padding: 14px 12px 3px;
  font-size: .65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: rgba(255,255,255,.25);
}
.crm-nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  color: rgba(255,255,255,.5);
  text-decoration: none; border-radius: 8px;
  font-size: .875rem; font-weight: 500;
  transition: var(--crm-transition);
  margin-bottom: 1px;
}
.crm-nav-link i { font-size: 1.05rem; min-width: 18px; text-align: center; }
.crm-nav-link:hover { color: rgba(255,255,255,.88); background: rgba(255,255,255,.07); }
.crm-nav-link.active {
  background: var(--crm-grad); color: #fff;
  box-shadow: 0 4px 14px rgba(102,126,234,.4);
}

.crm-sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
  background: rgba(0,0,0,.2);
  flex-shrink: 0;
}
.crm-user-block { display: flex; align-items: center; gap: 11px; }
.crm-user-avatar {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--crm-grad);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .85rem; font-weight: 700;
  flex-shrink: 0;
}
.crm-user-name { font-size: .82rem; font-weight: 600; color: #fff; display: block; }
.crm-user-role { font-size: .68rem; color: rgba(255,255,255,.35); display: block; text-transform: capitalize; }

/* ── MAIN ── */
.crm-main {
  margin-left: var(--crm-sidebar-w);
  display: flex; flex-direction: column; min-height: 100vh;
}
.crm-topbar {
  position: sticky; top: 0; z-index: 900;
  height: var(--crm-topbar-h);
  background: var(--crm-surface);
  border-bottom: 1px solid var(--crm-border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 14px;
  box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 2px 10px rgba(0,0,0,.04);
}
.crm-topbar-title { font-size: .95rem; font-weight: 600; color: var(--crm-text); flex: 1; }
.crm-content { padding: 24px; flex: 1; }

/* ── CARDS ── */
.crm-card {
  background: var(--crm-surface);
  border-radius: var(--crm-radius);
  box-shadow: var(--crm-shadow);
  border: 1px solid var(--crm-border);
  overflow: hidden;
}
.crm-card-header {
  padding: 15px 22px;
  border-bottom: 1px solid var(--crm-border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(180deg,#fafbff 0%,var(--crm-surface) 100%);
}
.crm-card-header h5,.crm-card-header h2,.crm-card-header h3 {
  margin: 0; font-size: .95rem; font-weight: 700; color: var(--crm-text);
  display: flex; align-items: center; gap: 8px;
}
.crm-card-header h5 i,.crm-card-header h2 i,.crm-card-header h3 i { color: var(--crm-p1); }
.crm-card-body { padding: 22px; }

/* ── STAT CARDS ── */
.crm-stat-card {
  background: var(--crm-surface);
  border-radius: var(--crm-radius);
  padding: 20px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--crm-shadow);
  border: 1px solid var(--crm-border);
  position: relative; overflow: hidden;
  transition: var(--crm-transition);
  text-decoration: none; color: inherit;
}
.crm-stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--crm-grad); transform: scaleX(0); transform-origin: left;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.crm-stat-card:hover { transform: translateY(-2px); box-shadow: var(--crm-shadow-md); }
.crm-stat-card:hover::before { transform: scaleX(1); }
.crm-stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.crm-stat-icon.blue   { background: linear-gradient(135deg,#dbeafe,#bfdbfe); color: #1d4ed8; }
.crm-stat-icon.green  { background: linear-gradient(135deg,#d1fae5,#a7f3d0); color: #065f46; }
.crm-stat-icon.orange { background: linear-gradient(135deg,#fef3c7,#fde68a); color: #92400e; }
.crm-stat-icon.purple { background: linear-gradient(135deg,#ede9fe,#ddd6fe); color: #5b21b6; }
.crm-stat-icon.red    { background: linear-gradient(135deg,#fee2e2,#fecaca); color: #991b1b; }
.crm-stat-value { font-size: 1.8rem; font-weight: 800; line-height: 1; color: var(--crm-text); }
.crm-stat-label { font-size: .78rem; color: var(--crm-muted); margin-top: 3px; font-weight: 500; }

/* ── TABLES ── */
.crm-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.crm-table th {
  padding: 10px 18px;
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .7px;
  color: var(--crm-muted); background: #f8faff;
  border-bottom: 2px solid var(--crm-border); white-space: nowrap;
}
.crm-table td { padding: 13px 18px; border-bottom: 1px solid #f0f4fb; vertical-align: middle; }
.crm-table tbody tr { transition: background .12s; }
.crm-table tbody tr:last-child td { border-bottom: none; }
.crm-table tbody tr:hover { background: #f7f9ff; }

/* ── BUTTONS ── */
.btn-primary,button.btn-primary {
  background: var(--crm-grad) !important;
  border: none !important; color: #fff !important;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(102,126,234,.3);
  transition: var(--crm-transition);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(102,126,234,.45) !important; opacity: .95; }
.btn-xs { padding: 3px 8px; font-size: .75rem; border-radius: 6px; }

/* ── FLASH ── */
.flash-container { position: fixed; top: 70px; right: 20px; z-index: 9999; width: 340px; }
.flash-item {
  border-radius: 10px; padding: 12px 16px; margin-bottom: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12); font-size: .875rem;
  display: flex; align-items: center; gap: 10px;
  animation: crmFadeIn .25s ease;
  cursor: pointer;
}
.flash-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.flash-error   { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.flash-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
@keyframes crmFadeIn { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }

/* ── STEPS ── */
.step-item {
  background: var(--crm-surface);
  border: 1.5px solid var(--crm-border);
  border-radius: 10px; padding: 14px 16px;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 12px;
  transition: box-shadow .15s, border-color .15s;
}
.step-item:hover { border-color: var(--crm-p1); box-shadow: 0 2px 12px rgba(102,126,234,.12); }
.step-item.done  { opacity: .65; }
.step-item.done .step-name { text-decoration: line-through; color: var(--crm-muted); }
.step-drag { color: #cbd5e0; cursor: grab; font-size: 1.1rem; }
.step-drag:active { cursor: grabbing; }
.step-number {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--crm-primary-light); color: var(--crm-p1);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; flex-shrink: 0;
}
.step-item.done .step-number { background: #d1fae5; color: #065f46; }
.step-item.in_progress .step-number { background: #fef3c7; color: #92400e; }
.step-name { font-weight: 600; font-size: .875rem; flex: 1; }
.step-desc { font-size: .78rem; color: var(--crm-muted); }
.step-sortable-ghost { opacity: .4; background: var(--crm-primary-light); }

/* ── DOCUMENTS ── */
.doc-card {
  background: var(--crm-surface);
  border: 1.5px solid var(--crm-border);
  border-radius: var(--crm-radius-sm);
  padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 12px;
  transition: var(--crm-transition);
  margin-bottom: 10px;
}
.doc-card:hover { border-color: var(--crm-p1); box-shadow: 0 2px 12px rgba(102,126,234,.1); }
.doc-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.doc-icon.charte   { background: #ede9fe; color: #6d28d9; }
.doc-icon.serveur  { background: #dbeafe; color: #1d4ed8; }
.doc-icon.lien     { background: #d1fae5; color: #065f46; }
.doc-icon.document { background: #fef3c7; color: #92400e; }
.doc-icon.autre    { background: #f3f4f6; color: #374151; }
.doc-title { font-weight: 600; font-size: .875rem; }
.doc-meta  { font-size: .75rem; color: var(--crm-muted); margin-top: 2px; }
.doc-content { font-size: .8rem; color: var(--crm-text); margin-top: 6px; white-space: pre-wrap; word-break: break-all; }

/* ── SERVER ACCESS BOX ── */
.server-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.server-field label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--crm-muted); }
.server-field .val  { font-family: monospace; font-size: .82rem; background: #f8faff; border: 1px solid var(--crm-border); border-radius: 6px; padding: 4px 8px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.server-field .val.password { letter-spacing: 2px; }

/* ── NOTES ── */
.note-item {
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  margin-bottom: 10px;
  position: relative;
}
.note-content { font-size: .875rem; white-space: pre-wrap; }
.note-meta { font-size: .72rem; color: var(--crm-muted); margin-top: 6px; }

/* ── TODOS ── */
.todo-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--crm-border);
  transition: background .1s;
}
.todo-item:last-child { border-bottom: none; }
.todo-item:hover { background: #f7f9ff; }
.todo-item.done .todo-task { text-decoration: line-through; color: var(--crm-muted); }
.todo-check { width: 18px; height: 18px; cursor: pointer; flex-shrink: 0; }
.todo-task { flex: 1; font-size: .875rem; }
.todo-due  { font-size: .72rem; color: var(--crm-muted); white-space: nowrap; }
.todo-due.overdue { color: var(--crm-danger); font-weight: 600; }

/* ── PROGRESS BAR ── */
.crm-progress { background: var(--crm-border); border-radius: 99px; height: 8px; overflow: hidden; }
.crm-progress-bar {
  height: 100%; border-radius: 99px;
  background: var(--crm-grad);
  transition: width .4s ease;
}

/* ── BREADCRUMB ── */
.crm-breadcrumb { font-size: .82rem; color: var(--crm-muted); margin-bottom: 16px; display: flex; align-items: center; gap: 6px; }
.crm-breadcrumb a { color: var(--crm-p1); text-decoration: none; }
.crm-breadcrumb a:hover { text-decoration: underline; }
.crm-breadcrumb .sep { color: #cbd5e0; }

/* ── PROJECT HEADER ── */
.project-hero {
  background: var(--crm-grad);
  border-radius: var(--crm-radius);
  padding: 28px 28px 24px;
  color: #fff;
  margin-bottom: 24px;
  position: relative; overflow: hidden;
}
.project-hero::before {
  content: ''; position: absolute; right: -40px; top: -40px;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,.07);
}
.project-hero-title { font-size: 1.5rem; font-weight: 800; margin: 0; }
.project-hero-meta  { font-size: .85rem; opacity: .8; margin-top: 4px; }
.project-hero-badge { display: inline-flex; align-items: center; gap: 5px; background: rgba(255,255,255,.2); border-radius: 20px; padding: 3px 12px; font-size: .78rem; font-weight: 600; }

/* ── MISC ── */
.min-width-0 { min-width: 0; }
.flex-1 { flex: 1; }
.text-gradient { background: var(--crm-grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.avatar-circle {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--crm-grad);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: .82rem; font-weight: 700; text-transform: uppercase;
  flex-shrink: 0;
}

/* ── RESPONSIVE ── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--crm-grad); }
.login-card { background: #fff; border-radius: 18px; padding: 40px 36px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon { width: 56px; height: 56px; background: var(--crm-grad); border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.6rem; color: #fff; margin-bottom: 10px; box-shadow: 0 6px 20px rgba(102,126,234,.4); }
.login-logo-text { font-size: 1.3rem; font-weight: 800; color: var(--crm-text); }

/* ── PROSPECTS ── */
.prospect-overdue-row { background: #fff5f5 !important; }
.crm-source-badge {
  display: inline-block; font-size: .7rem; font-weight: 600;
  padding: 2px 10px; border-radius: 20px;
  background: #ede9fe; color: #5b21b6;
}
.priority-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .68rem; font-weight: 700; padding: 2px 8px; border-radius: 20px;
}
.priority-badge.priority-mineure { background: #f1f5f9; color: #64748b; }
.priority-badge.priority-low     { background: #d1fae5; color: #065f46; }
.priority-badge.priority-medium  { background: #dbeafe; color: #1d4ed8; }
.priority-badge.priority-high    { background: #fef3c7; color: #92400e; }
.priority-badge.priority-urgent  { background: #fee2e2; color: #991b1b; animation: pulseUrgent 1.5s infinite; }
@keyframes pulseUrgent {
  0%,100% { box-shadow: 0 0 0 0 rgba(229,62,62,.4); }
  50% { box-shadow: 0 0 0 4px rgba(229,62,62,0); }
}

/* ── ACCÈS ── */
.acces-card {
  background: var(--crm-surface);
  border: 1.5px solid var(--crm-border);
  border-radius: var(--crm-radius-sm);
  padding: 16px;
  transition: var(--crm-transition);
  position: relative;
}
.acces-card:hover { border-color: var(--crm-p1); box-shadow: 0 2px 12px rgba(102,126,234,.1); }
.acces-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.acces-icon.cpanel,
.acces-icon.plesk    { background:#dbeafe; color:#1d4ed8; }
.acces-icon.ftp,
.acces-icon.ftps,
.acces-icon.sftp     { background:#fef3c7; color:#92400e; }
.acces-icon.ssh      { background:#1e293b; color:#94a3b8; }
.acces-icon.wordpress{ background:#ede9fe; color:#5b21b6; }
.acces-icon.database { background:#d1fae5; color:#065f46; }
.acces-icon.hosting  { background:#fce7f3; color:#9d174d; }
.acces-icon.email    { background:#dbeafe; color:#1e40af; }
.acces-icon.autre    { background:#f1f5f9; color:#64748b; }
.acces-name  { font-weight: 700; font-size: .92rem; }
.acces-type  { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .7px; color: var(--crm-muted); }
.cred-row {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 0; border-bottom: 1px solid #f0f4fb; font-size: .82rem;
}
.cred-row:last-child { border-bottom: none; }
.cred-label { min-width: 90px; font-weight: 600; color: var(--crm-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; }
.cred-val { flex: 1; font-family: monospace; background: #f8faff; border: 1px solid var(--crm-border); border-radius: 5px; padding: 2px 8px; }
.cred-val.masked { letter-spacing: 3px; }
.cred-copy { background: none; border: none; cursor: pointer; color: var(--crm-muted); padding: 2px 4px; border-radius: 4px; transition: var(--crm-transition); }
.cred-copy:hover { background: var(--crm-primary-light); color: var(--crm-p1); }
.acces-url-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--crm-grad); color: #fff; border: none; border-radius: 8px;
  padding: 6px 14px; font-size: .82rem; font-weight: 600;
  text-decoration: none; cursor: pointer; transition: var(--crm-transition);
}
.acces-url-btn:hover { opacity: .9; color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(102,126,234,.4); }

/* ── MEDIA ── */
.crm-sidebar-toggle {
  display: none; background: none; border: 1px solid var(--crm-border);
  border-radius: 8px; color: var(--crm-muted); font-size: 1.1rem;
  cursor: pointer; padding: 5px 10px; transition: var(--crm-transition);
}
.crm-sidebar-toggle:hover { border-color: var(--crm-p1); color: var(--crm-p1); }
.crm-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 999; }

@media (max-width: 768px) {
  .crm-sidebar { transform: translateX(-100%); }
  .crm-sidebar.show { transform: translateX(0); }
  .crm-main { margin-left: 0; }
  .crm-sidebar-toggle { display: block; }
  .crm-overlay.show { display: block; }
  .crm-content { padding: 16px; }
  .server-fields { grid-template-columns: 1fr; }
}
