/* ═══════════════════════════════════════════════════
   KASHERHUB PRO - Backend CSS
   ═══════════════════════════════════════════════════ */

:root {
  --noir: #0F0F12;
  --gris-d: #2C2C30;
  --gris: #6B6B70;
  --gris-l: #E5E5E8;
  --gris-bg: #F8F8F9;
  --beige: #FAF7F2;
  --gold: #C4A055;
  --gold-d: #A88840;
  --gold-light: #FFF3D6;
  --green: #16A34A;
  --green-light: #D1FAE5;
  --orange: #EA580C;
  --orange-light: #FED7AA;
  --red: #DC2626;
  --red-light: #FEE2E2;
  --blue: #2563EB;
  --blue-light: #DBEAFE;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Manrope', -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--sans);
  color: var(--noir);
  background: var(--gris-bg);
  line-height: 1.6;
  font-size: 14.5px;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--gold); }

/* ═══ HEADER ═══ */
.kh-header {
  background: white;
  border-bottom: 1px solid var(--gris-l);
  position: sticky; top: 0; z-index: 100;
}
.kh-header-inner {
  max-width: 1400px; margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; gap: 32px;
}
.kh-logo { display: flex; align-items: center; gap: 10px; }
.kh-logo-square {
  background: var(--noir); color: white;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 1.2rem; font-weight: 700;
  border-radius: 4px;
}
.kh-logo-text { font-family: var(--serif); font-size: 1.3rem; }
.kh-logo-text strong { color: var(--gold); }
.kh-nav { display: flex; gap: 4px; flex: 1; }
.kh-nav-link {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--gris-d);
  transition: all 0.2s;
}
.kh-nav-link:hover { background: var(--gris-bg); color: var(--noir); }
.kh-nav-link.active { background: var(--noir); color: white; }
.kh-user {
  display: flex; align-items: center; gap: 14px;
  font-size: 0.85rem;
}
.kh-user-name { font-weight: 600; }
.kh-logout {
  padding: 6px 12px;
  border: 1px solid var(--gris-l);
  border-radius: 4px;
  font-size: 0.78rem;
  transition: all 0.2s;
}
.kh-logout:hover { background: var(--noir); color: white; }

/* ═══ MAIN ═══ */
.kh-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ═══ FLASH MESSAGES ═══ */
.kh-flash-container {
  margin-bottom: 24px;
  display: flex; flex-direction: column; gap: 8px;
}
.kh-flash {
  padding: 12px 18px;
  border-radius: 6px;
  font-size: 0.9rem;
  border-left: 4px solid;
}
.kh-flash-success { background: var(--green-light); color: var(--green); border-color: var(--green); }
.kh-flash-error { background: var(--red-light); color: var(--red); border-color: var(--red); }
.kh-flash-warning { background: var(--orange-light); color: var(--orange); border-color: var(--orange); }
.kh-flash-info { background: var(--blue-light); color: var(--blue); border-color: var(--blue); }

/* ═══ DASHBOARD HEADER ═══ */
.kh-dashboard-header {
  margin-bottom: 28px;
}
.kh-dashboard-header h1 {
  font-family: var(--serif);
  font-size: 2.2rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.kh-subtitle {
  color: var(--gris);
  font-size: 0.95rem;
}

/* ═══ DEMO BANNER ═══ */
.kh-demo-banner {
  background: linear-gradient(135deg, var(--gold-light), #FFE9A8);
  border-left: 4px solid var(--gold);
  padding: 14px 20px;
  border-radius: 6px;
  margin-bottom: 24px;
  font-size: 0.9rem;
}
.kh-demo-banner a { color: var(--gold-d); font-weight: 600; }

/* ═══ STATS GRID ═══ */
.kh-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.kh-stat-card {
  background: white;
  border: 1px solid var(--gris-l);
  border-radius: 8px;
  padding: 20px 24px;
  transition: all 0.2s;
}
.kh-stat-card:hover {
  border-color: var(--gold);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.kh-stat-card.kh-stat-success { border-left: 4px solid var(--green); }
.kh-stat-card.kh-stat-warning { border-left: 4px solid var(--orange); }
.kh-stat-label {
  font-size: 0.8rem;
  color: var(--gris);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.kh-stat-value {
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 700;
  margin: 6px 0 2px;
  line-height: 1.1;
}
.kh-stat-sub {
  font-size: 0.78rem;
  color: var(--gris);
}

/* ═══ QUICK ACTIONS ═══ */
.kh-quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}
.kh-quick-card {
  background: white;
  border: 1px solid var(--gris-l);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.2s;
}
.kh-quick-card:hover {
  border-color: var(--gold);
  background: var(--gold-light);
  transform: translateY(-2px);
}
.kh-quick-icon {
  font-size: 2rem;
  width: 48px;
  height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: var(--gris-bg);
  border-radius: 8px;
}
.kh-quick-card:hover .kh-quick-icon { background: white; }
.kh-quick-title {
  font-weight: 600;
  font-size: 1rem;
}
.kh-quick-desc {
  font-size: 0.82rem;
  color: var(--gris);
}

/* ═══ SECTIONS ═══ */
.kh-section {
  background: white;
  border: 1px solid var(--gris-l);
  border-radius: 8px;
  padding: 24px 28px;
  margin-bottom: 20px;
}
.kh-section h2 {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
  margin-bottom: 16px;
}
.kh-section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.kh-section-header h2 { margin: 0; }
.kh-link {
  color: var(--gold);
  font-weight: 600;
  font-size: 0.88rem;
}

/* ═══ LEADS LIST (sur dashboard) ═══ */
.kh-leads-list {
  display: flex; flex-direction: column;
  gap: 8px;
}
.kh-lead-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  padding: 12px 16px;
  background: var(--gris-bg);
  border-radius: 6px;
  align-items: center;
}
.kh-lead-status {
  font-size: 1.4rem;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: white;
  border-radius: 6px;
}
.kh-lead-content { font-size: 0.88rem; }
.kh-lead-title { font-weight: 600; }
.kh-lead-type {
  font-size: 0.78rem;
  background: var(--gold-light);
  color: var(--gold-d);
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
  font-weight: 500;
}
.kh-lead-meta {
  font-size: 0.78rem;
  color: var(--gris);
  margin-top: 2px;
}
.kh-lead-msg {
  font-size: 0.82rem;
  color: var(--gris-d);
  margin-top: 4px;
  font-style: italic;
}
.kh-lead-date {
  font-size: 0.78rem;
  color: var(--gris);
}

/* ═══ LEADS PAGE - Cards ═══ */
.kh-leads-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 16px;
}
.kh-lead-card {
  background: white;
  border: 1px solid var(--gris-l);
  border-radius: 8px;
  padding: 20px;
  border-left: 4px solid var(--gris-l);
}
.kh-lead-card.kh-lead-status-nouveau { border-left-color: var(--orange); }
.kh-lead-card.kh-lead-status-lu { border-left-color: var(--blue); }
.kh-lead-card.kh-lead-status-repondu { border-left-color: var(--blue); }
.kh-lead-card.kh-lead-status-gagne { border-left-color: var(--green); }
.kh-lead-card.kh-lead-status-perdu { border-left-color: var(--gris); opacity: 0.7; }

.kh-lead-card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.kh-lead-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}
.kh-lead-info-grid > div { padding: 4px 0; }
.kh-lead-message {
  background: var(--gris-bg);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 0.85rem;
  margin: 12px 0;
}
.kh-lead-message p { margin-top: 4px; }
.kh-lead-card-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--gris-l);
}
.kh-status-form select {
  padding: 6px 10px;
  border: 1px solid var(--gris-l);
  border-radius: 4px;
  font-size: 0.82rem;
  cursor: pointer;
}

/* ═══ TABLE ═══ */
.kh-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--gris-l);
  border-radius: 6px;
}
.kh-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.kh-table th {
  background: var(--gris-bg);
  text-align: left;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gris-d);
  border-bottom: 1px solid var(--gris-l);
}
.kh-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gris-l);
}
.kh-table tr:hover { background: var(--gold-light); }
.kh-table tr:last-child td { border-bottom: none; }

/* ═══ BADGES ═══ */
.kh-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.kh-badge-success { background: var(--green-light); color: var(--green); }
.kh-badge-warning { background: var(--orange-light); color: var(--orange); }
.kh-badge-info { background: var(--blue-light); color: var(--blue); }
.kh-badge-muted { background: var(--gris-bg); color: var(--gris); }

/* Catégorie badges */
.kh-cat-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
  background: var(--gris-bg);
  color: var(--gris-d);
}
.kh-cat-traiteur { background: #F4E4D6; color: #8B5A2B; }
.kh-cat-salle { background: #E8E4D6; color: #6B5F3F; }
.kh-cat-synagogue { background: #D6DCE8; color: #1A2845; }
.kh-cat-orchestre { background: #2C2C30; color: white; }
.kh-cat-dj { background: #F0E8D8; color: #8B6F47; }
.kh-cat-photographe { background: #D6DBDD; color: #2C3539; }
.kh-cat-robe { background: #F0DDD2; color: #8B5A4B; }
.kh-cat-fleuriste { background: #E8E5DE; color: #6B5F4F; }
.kh-cat-costume { background: #D8DDE8; color: #1B2E5A; }
.kh-cat-wedding-planner { background: #E8DAD2; color: #8B5A4B; }

/* ═══ FORMULAIRE ═══ */
.kh-form, .kh-form-wide {
  display: flex; flex-direction: column;
  gap: 18px;
}
.kh-form-section {
  background: var(--gris-bg);
  padding: 20px 24px;
  border-radius: 6px;
  margin-bottom: 16px;
}
.kh-form-section h2 {
  font-family: var(--serif);
  font-size: 1.2rem;
  margin-bottom: 14px;
}
.kh-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.kh-form-group {
  display: flex; flex-direction: column;
  gap: 6px;
}
.kh-form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gris-d);
  letter-spacing: 0.03em;
}
.kh-form-group input,
.kh-form-group select,
.kh-form-group textarea {
  padding: 10px 14px;
  border: 1px solid var(--gris-l);
  border-radius: 5px;
  font-size: 0.92rem;
  font-family: inherit;
  background: white;
  transition: border-color 0.2s;
}
.kh-form-group input:focus,
.kh-form-group select:focus,
.kh-form-group textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-light);
}
.kh-form-help {
  font-size: 0.82rem;
  color: var(--gris);
  margin-bottom: 12px;
  font-style: italic;
}
.kh-form-buttons {
  display: flex; gap: 12px; justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--gris-l);
  margin-top: 8px;
}
.kh-form-inline {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

/* ═══ BUTTONS ═══ */
.kh-btn-primary {
  background: var(--noir);
  color: white;
  padding: 10px 20px;
  border-radius: 5px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  text-transform: uppercase;
}
.kh-btn-primary:hover { background: var(--gold); color: white; }
.kh-btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.kh-btn-secondary {
  background: white;
  color: var(--noir);
  padding: 9px 18px;
  border: 1px solid var(--gris-l);
  border-radius: 5px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.kh-btn-secondary:hover { border-color: var(--gold); color: var(--gold); }

.kh-btn-large { padding: 14px 28px; font-size: 0.92rem; }
.kh-btn-sm { padding: 6px 12px; font-size: 0.75rem; }
.kh-btn-xs { padding: 4px 8px; font-size: 0.72rem; margin-right: 4px; }

/* ═══ FILTERS ═══ */
.kh-filters {
  display: flex; gap: 14px; align-items: end;
  flex-wrap: wrap;
}
.kh-filter-group {
  display: flex; flex-direction: column;
  gap: 4px;
  min-width: 160px;
}
.kh-filter-group.kh-filter-grow { flex: 1; min-width: 200px; }
.kh-filter-group label {
  font-size: 0.78rem;
  color: var(--gris);
  font-weight: 500;
}
.kh-filter-group select,
.kh-filter-group input {
  padding: 8px 12px;
  border: 1px solid var(--gris-l);
  border-radius: 5px;
  font-size: 0.88rem;
  background: white;
}

/* ═══ INFO GRID ═══ */
.kh-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  font-size: 0.88rem;
}
.kh-info-grid > div { padding: 8px 0; }

/* ═══ EDIT PAGE ═══ */
.kh-edit-header {
  display: flex; justify-content: space-between; align-items: start;
  margin-bottom: 24px;
}
.kh-edit-header h1 {
  font-family: var(--serif);
  font-size: 1.8rem;
}
.kh-edit-actions { display: flex; gap: 8px; }

/* ═══ EMPTY ═══ */
.kh-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--gris);
}
.kh-empty p { font-size: 1.05rem; margin-bottom: 6px; }
.kh-empty-sub { font-size: 0.88rem; }

/* ═══ TEXT UTILS ═══ */
.kh-text-muted { color: var(--gris); }

/* ═══ FOOTER ═══ */
.kh-footer {
  margin-top: 60px;
  padding: 24px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--gris);
  border-top: 1px solid var(--gris-l);
}
.kh-footer a { color: var(--gold); }

/* ═══ LOGIN PAGE ═══ */
.kh-login-body {
  background: linear-gradient(135deg, #0F0F12, #2C2C30);
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.kh-login-wrapper {
  width: 100%;
  max-width: 440px;
}
.kh-login-card {
  background: white;
  padding: 40px 36px;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.kh-login-logo {
  display: flex; align-items: center; gap: 10px;
  justify-content: center;
  margin-bottom: 24px;
}
.kh-logo-square-big {
  background: var(--noir); color: white;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 1.6rem; font-weight: 700;
  border-radius: 6px;
}
.kh-logo-text-big {
  font-family: var(--serif);
  font-size: 1.6rem;
}
.kh-login-card h1 {
  font-family: var(--serif);
  font-size: 1.6rem;
  text-align: center;
  margin-bottom: 6px;
}
.kh-login-subtitle {
  text-align: center;
  color: var(--gris);
  font-size: 0.92rem;
  margin-bottom: 28px;
}
.kh-login-card .kh-btn-primary {
  width: 100%;
  padding: 14px;
  font-size: 0.92rem;
  margin-top: 8px;
}
.kh-login-help {
  margin-top: 24px;
  padding: 16px;
  background: var(--gold-light);
  border-radius: 6px;
  font-size: 0.85rem;
  text-align: center;
}
.kh-login-help code {
  background: white;
  padding: 2px 8px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--gold-d);
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 968px) {
  .kh-header-inner { flex-wrap: wrap; gap: 12px; }
  .kh-nav { width: 100%; flex-wrap: wrap; }
  .kh-form-row { grid-template-columns: 1fr; }
  .kh-form-inline { grid-template-columns: 1fr; }
  .kh-leads-cards { grid-template-columns: 1fr; }
  .kh-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .kh-stats-grid { grid-template-columns: 1fr; }
  .kh-table { font-size: 0.78rem; }
  .kh-table th, .kh-table td { padding: 8px; }
  .kh-section { padding: 16px; }
  .kh-quick-actions { grid-template-columns: 1fr; }
}
