* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  background: #f4f6fa;
  color: #1f2933;
  font-size: 14px;
}

.topnav {
  display: flex;
  align-items: center;
  background: #1f2933;
  color: #fff;
  padding: 0 24px;
  height: 56px;
}
.topnav .brand { font-weight: 700; font-size: 18px; margin-right: 32px; }
.topnav .brand a { color: #fff; text-decoration: none; }
.topnav .links { display: flex; gap: 24px; flex: 1; }
.topnav .links a { color: #cfd8dc; text-decoration: none; }
.topnav .links a:hover { color: #fff; }
.topnav .user { display: flex; align-items: center; gap: 16px; }
.topnav .user a { color: #cfd8dc; text-decoration: none; }

.container {
  max-width: 1100px;
  margin: 32px auto;
  padding: 0 24px;
}

h1 { font-size: 24px; margin-top: 0; }
h2 { font-size: 18px; margin-top: 32px; }
h3 { font-size: 15px; margin-top: 0; }

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.grid.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.card {
  background: #fff;
  border: 1px solid #e4e7eb;
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.card .stat { font-size: 28px; font-weight: 700; }
.card .label { color: #7b8794; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }

.btn {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 6px;
  background: #e4e7eb;
  color: #1f2933;
  border: 1px solid #cbd2d9;
  cursor: pointer;
  text-decoration: none;
  font-size: 13px;
}
.btn:hover { background: #cbd2d9; }
.btn.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn.primary:hover { background: #1d4ed8; }
.link-danger { background: none; border: none; color: #c0392b; cursor: pointer; padding: 0; font-size: 13px; }

.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e4e7eb;
}
.table th, .table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #e4e7eb;
  vertical-align: top;
}
.table th { background: #f4f6fa; font-weight: 600; font-size: 12px; text-transform: uppercase; color: #52606d; }
.table tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 600;
}
.badge-new { background: #fef3c7; color: #92400e; }
.badge-contacted { background: #d1fae5; color: #065f46; }
.badge-dismissed { background: #e4e7eb; color: #52606d; }

.score {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  cursor: help;
}
.score-high { background: #d1fae5; color: #065f46; }
.score-mid  { background: #fef3c7; color: #92400e; }
.score-low  { background: #fee2e2; color: #991b1b; }

.badge-stage { background: #dbeafe; color: #1e40af; }

/* Recherche */
.search-bar { display: flex; gap: 8px; margin-bottom: 24px; }
.search-bar input[type=search] {
  flex: 1;
  border: 1px solid #cbd2d9;
  border-radius: 6px;
  padding: 9px 12px;
  font: inherit;
}

/* KPIs */
.grid.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.grid.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.mini-table { width: 100%; border-collapse: collapse; }
.mini-table td { padding: 5px 6px; border-bottom: 1px solid #eef1f5; }
.mini-table td.num { text-align: right; font-weight: 600; width: 48px; }
.mini-table td.bar-cell { width: 40%; }
.mini-table .bar {
  display: inline-block; height: 8px; border-radius: 4px;
  background: #2563eb; min-width: 2px; vertical-align: middle;
}

/* Kanban CRM */
.kanban {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: flex-start;
}
.kanban-col {
  flex: 0 0 240px;
  background: #eef1f5;
  border-radius: 8px;
  padding: 8px;
}
.kanban-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 13px;
  text-transform: capitalize;
  padding: 4px 6px 8px;
}
.kanban-count {
  background: #cbd2d9; color: #1f2933;
  border-radius: 999px; padding: 0 8px; font-size: 11px;
}
.kanban-body { display: flex; flex-direction: column; gap: 8px; }
.kanban-card {
  background: #fff;
  border: 1px solid #e4e7eb;
  border-radius: 6px;
  padding: 8px 10px;
}
.kanban-title { font-weight: 500; text-decoration: none; color: #1f2933; display: block; margin-bottom: 4px; font-size: 13px; }
.kanban-title:hover { color: #2563eb; }
.kanban-meta { display: flex; gap: 6px; align-items: center; font-size: 11px; color: #7b8794; margin-top: 2px; }
.kanban-action { font-size: 11px; color: #52606d; margin-top: 6px; }
.kanban-action.overdue { color: #991b1b; font-weight: 600; }
.kanban-move { margin-top: 8px; }
.kanban-move select { width: 100%; border: 1px solid #cbd2d9; border-radius: 4px; padding: 3px 6px; font-size: 12px; }
.kanban-empty { color: #b0b8c1; text-align: center; font-size: 12px; padding: 8px 0; }

/* CRM detail */
.crm-row { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: end; }
.crm-field label { font-size: 12px; color: #52606d; display: block; margin-bottom: 4px; }
.crm-field select { width: 100%; border: 1px solid #cbd2d9; border-radius: 6px; padding: 7px 10px; font: inherit; }

/* Timeline notes */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 2px solid #cbd2d9; padding: 0 0 12px 12px; margin-left: 4px; }
.timeline-meta { font-size: 11px; color: #7b8794; display: flex; gap: 8px; align-items: center; }
.timeline-body { white-space: pre-wrap; margin-top: 2px; }

.flashes { margin-bottom: 16px; }
.flash {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 8px;
}
.flash-success { background: #d1fae5; color: #065f46; }
.flash-error { background: #fee2e2; color: #991b1b; }
.flash-info { background: #dbeafe; color: #1e40af; }

.auth-card {
  background: #fff;
  max-width: 360px;
  margin: 80px auto;
  padding: 24px;
  border-radius: 8px;
  border: 1px solid #e4e7eb;
}
.auth-card form, .form-narrow, .form-wide {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.form-narrow { max-width: 380px; }
.form-wide { max-width: 680px; background: #fff; padding: 20px; border: 1px solid #e4e7eb; border-radius: 8px; }
label { font-weight: 500; font-size: 13px; color: #3e4c59; display: flex; flex-direction: column; gap: 4px; }
.inline-check { flex-direction: row; align-items: center; gap: 8px; }
input[type=text], input[type=password], input[type=url], input[type=email], textarea {
  border: 1px solid #cbd2d9;
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}
textarea { font-family: inherit; resize: vertical; }

.inline { display: inline-block; margin: 0; }
.filters { display: flex; gap: 8px; }
.actions { display: flex; gap: 8px; margin-top: 16px; }
.meta { display: flex; gap: 16px; flex-wrap: wrap; color: #52606d; margin-bottom: 16px; font-size: 13px; }
.back { color: #2563eb; text-decoration: none; font-size: 13px; }
.muted { color: #7b8794; font-size: 13px; }

.enrich {
  background: #f4f6fa;
  border: 1px solid #e4e7eb;
  border-radius: 6px;
  padding: 12px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 360px;
  overflow: auto;
}

details { background: #fff; border: 1px solid #e4e7eb; border-radius: 6px; padding: 8px 12px; margin-bottom: 8px; }
details summary { cursor: pointer; font-weight: 500; }

code { background: #f4f6fa; padding: 1px 6px; border-radius: 4px; font-size: 12px; }
