/* ── Variables ───────────────────────────────────────────── */
:root {
  /* Brand — aligned with LeadTrack landing */
  --primary:       #0ECFA4;
  --primary-hover: #0AA882;
  --primary-dark:  #088a6b;
  --primary-text:  #0B1120;
  --primary-glow:  rgba(14,207,164,0.15);
  --nav-bg:        #0B1120;
  --nav-border:    rgba(14,207,164,0.18);
  --nav-text:      #8BA3BF;

  /* Semantic */
  --success:       #16a34a;
  --warning:       #d97706;
  --danger:        #dc2626;

  /* Grays */
  --gray-50:       #f9fafb;
  --gray-100:      #f3f4f6;
  --gray-200:      #e5e7eb;
  --gray-300:      #d1d5db;
  --gray-500:      #6b7280;
  --gray-600:      #4b5563;
  --gray-700:      #374151;
  --gray-900:      #111827;

  --radius:        6px;
  --shadow:        0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:     0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
}

/* ── Fonts ───────────────────────────────────────────────── */
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; }

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-size: 14px; line-height: 1.5; color: var(--gray-700); background: var(--gray-50); }
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Nav ─────────────────────────────────────────────────── */
.nav {
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  height: 52px;
  position: sticky; top: 0; z-index: 100;
}
.nav-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 24px;
  height: 100%; display: flex; align-items: center; gap: 24px;
}
.nav-brand {
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 16px; font-weight: 700; color: #fff;
  display: flex; align-items: center; gap: 8px;
  text-decoration: none;
}
.nav-brand:hover { color: #fff; text-decoration: none; }
.nav-brand-dot {
  width: 8px; height: 8px; background: var(--primary);
  border-radius: 50%; flex-shrink: 0; display: inline-block;
}
.nav-links { display: flex; gap: 4px; list-style: none; flex: 1; }
.nav-links a {
  padding: 6px 12px; border-radius: var(--radius);
  color: var(--nav-text); font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-links a:hover { background: var(--primary-glow); color: #fff; text-decoration: none; }
.nav-links a.active { background: var(--primary-glow); color: var(--primary); border: 1px solid var(--nav-border); }

/* ── Main content ────────────────────────────────────────── */
.main-content { max-width: 1280px; margin: 0 auto; padding: 24px; }

/* ── Flash messages ──────────────────────────────────────── */
.flash-container { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.flash {
  padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
}
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* ── Page header ─────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--gray-900); }
.header-actions { display: flex; gap: 8px; }
.back-link { font-size: 13px; color: var(--gray-500); display: block; margin-bottom: 4px; }
.back-link:hover { color: var(--gray-700); text-decoration: none; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius); border: none;
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background 0.1s, transform 0.1s;
  text-decoration: none; line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn-primary  { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-secondary { background: #fff; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-50); }
.btn-danger   { background: #fff; color: var(--danger); border: 1px solid #fca5a5; }
.btn-danger:hover { background: #fee2e2; }
.btn-ghost    { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-900); }
.btn-sm  { padding: 5px 10px; font-size: 12px; }
.btn-xs  { padding: 3px 8px; font-size: 11px; }

/* ── Stats row ───────────────────────────────────────────── */
.stats-row {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 12px; margin-bottom: 20px;
}
.stat-card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.stat-card-link { text-decoration: none; transition: border-color 0.15s; cursor: pointer; }
.stat-card-link:hover { border-color: var(--primary); text-decoration: none; }
.stat-card-green .stat-num { color: var(--success); }
.stat-num { font-size: 24px; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.stat-lbl { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* ── Filters ─────────────────────────────────────────────── */
.filters-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 16px; flex-wrap: wrap;
}
.filter-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.filter-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--radius);
  color: var(--gray-600); font-size: 13px; text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.1s;
}
.filter-tab:hover { background: var(--gray-100); text-decoration: none; }
.filter-tab.active { background: var(--gray-100); border-color: var(--gray-300); color: var(--gray-900); font-weight: 500; }
.filter-count { font-size: 11px; color: var(--gray-500); background: var(--gray-100); padding: 1px 6px; border-radius: 9px; }
.search-form { display: flex; gap: 6px; align-items: center; }
.input-search {
  padding: 6px 10px; border: 1px solid var(--gray-300); border-radius: var(--radius);
  font-size: 13px; width: 200px; outline: none;
}
.input-search:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-glow); }

/* ── Table ───────────────────────────────────────────────── */
.table-wrapper {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 10px 12px; text-align: left; font-size: 11px; font-weight: 600;
  color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--gray-50); border-bottom: 1px solid var(--gray-200);
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--gray-50); }
.lead-name-link { font-weight: 500; color: var(--gray-900); }
.lead-name-link:hover { color: var(--primary); }
.row-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.1s; }
.table tr:hover .row-actions { opacity: 1; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--gray-500); }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 9px;
  font-size: 11px; font-weight: 600;
}
.badge-lg { padding: 4px 12px; font-size: 13px; }
.badge-nuevo      { background: #f3f4f6; color: #374151; }
.badge-calificado { background: #dbeafe; color: #1e40af; }
.badge-propuesta  { background: #fef3c7; color: #92400e; }
.badge-cerrado    { background: #dcfce7; color: #166534; }
.badge-fuente     { background: var(--gray-100); color: var(--gray-600); }
.badge-activity-llamada  { background: #ede9fe; color: #5b21b6; }
.badge-activity-email    { background: #e0f2fe; color: #0369a1; }
.badge-activity-whatsapp { background: #dcfce7; color: #166534; }
.badge-activity-nota     { background: var(--gray-100); color: var(--gray-600); }

/* ── Reminder badge ──────────────────────────────────────── */
.reminder-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--gray-200); color: var(--gray-600);
  font-size: 11px; font-weight: 600;
}
.reminder-badge-overdue { background: #fee2e2; color: var(--danger); }
.text-danger { color: var(--danger); }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 48px; text-align: center; color: var(--gray-500);
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}

/* ── Kanban ──────────────────────────────────────────────── */
.kanban-board {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; align-items: start;
}
.kanban-col {
  background: var(--gray-100); border-radius: var(--radius);
  border: 1px solid var(--gray-200); overflow: hidden;
}
.kanban-col-header {
  padding: 10px 12px; background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.kanban-count {
  font-size: 11px; font-weight: 600; color: var(--gray-500);
  background: var(--gray-200); padding: 1px 6px; border-radius: 9px;
}
.kanban-cards { padding: 8px; min-height: 80px; display: flex; flex-direction: column; gap: 8px; }
.kanban-card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 10px 12px; cursor: grab; box-shadow: var(--shadow);
  transition: transform 0.1s, box-shadow 0.1s;
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kanban-card.dragging { opacity: 0.4; cursor: grabbing; transform: rotate(1deg); }
.kanban-cards.drag-over {
  outline: 2px dashed var(--primary);
  outline-offset: -2px;
  background: var(--primary-glow);
  border-radius: var(--radius);
}
.kanban-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.kanban-card-name { font-weight: 500; color: var(--gray-900); font-size: 13px; }
.kanban-card-name:hover { color: var(--primary); text-decoration: none; }
.kanban-card-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.kanban-valor { font-size: 12px; color: var(--success); font-weight: 600; margin-left: auto; }
.kanban-card-date { font-size: 11px; color: var(--gray-500); margin-top: 4px; }

/* ── Forms ───────────────────────────────────────────────── */
.form-container { max-width: 640px; }
.form-section { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.form-section-title { font-size: 13px; font-weight: 600; color: var(--gray-900); margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--gray-100); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group-full { grid-column: 1 / -1; }
.form-group label { font-size: 12px; font-weight: 500; color: var(--gray-700); }
.required { color: var(--danger); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.input {
  padding: 7px 10px; border: 1px solid var(--gray-300); border-radius: var(--radius);
  font-size: 13px; color: var(--gray-900); font-family: inherit; outline: none;
  transition: border-color 0.1s, box-shadow 0.1s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-glow); }
.input-sm { padding: 5px 8px; font-size: 12px; }
.textarea { resize: vertical; min-height: 80px; }
.textarea-sm { min-height: 56px; }

/* ── Detail layout ───────────────────────────────────────── */
.detail-layout { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start; }
.detail-sidebar { display: flex; flex-direction: column; gap: 16px; }
.card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card-title { font-size: 13px; font-weight: 600; color: var(--gray-900); margin-bottom: 12px; }
.detail-etapa-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.detail-fields { display: flex; flex-direction: column; gap: 10px; }
.detail-field { display: flex; flex-direction: column; gap: 2px; }
.detail-field-label { font-size: 11px; font-weight: 500; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.04em; }
.detail-field-value { font-size: 13px; color: var(--gray-900); }
.detail-valor { font-weight: 600; color: var(--success); font-size: 15px; }
.detail-notas { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--gray-100); }
.notas-text { font-size: 13px; color: var(--gray-600); white-space: pre-wrap; margin-top: 4px; }

/* ── Etapa buttons in sidebar ────────────────────────────── */
.etapa-buttons { display: flex; flex-direction: column; gap: 6px; }
.etapa-form { display: contents; }
.btn-etapa {
  width: 100%; justify-content: center; padding: 6px 12px;
  font-size: 12px; font-weight: 600; border-radius: var(--radius);
  cursor: pointer; border: 1.5px solid transparent;
  transition: opacity 0.1s;
}
.btn-etapa.badge-nuevo      { background: #f3f4f6; color: #374151; border-color: #d1d5db; }
.btn-etapa.badge-calificado { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.btn-etapa.badge-propuesta  { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.btn-etapa.badge-cerrado    { background: #dcfce7; color: #166534; border-color: #86efac; }
.btn-etapa-active { opacity: 1; box-shadow: inset 0 0 0 1.5px currentColor; }
.btn-etapa:not(.btn-etapa-active) { opacity: 0.5; }
.btn-etapa:hover { opacity: 1; }

/* ── Reminders in detail ─────────────────────────────────── */
.reminder-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.reminder-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: var(--radius); border: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.reminder-done { opacity: 0.5; }
.reminder-overdue { background: #fff5f5; border-color: #fca5a5; }
.reminder-info { display: flex; flex-direction: column; gap: 2px; }
.reminder-tipo { font-size: 12px; font-weight: 600; color: var(--gray-700); }
.reminder-fecha { font-size: 11px; }

/* ── Timeline ────────────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 0; margin-top: 12px; }
.timeline-item { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.timeline-item::before {
  content: ''; position: absolute; left: 8px; top: 20px; bottom: 0;
  width: 1px; background: var(--gray-200);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; margin-top: 2px;
  border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--gray-300);
}
.timeline-dot-llamada  { background: #8b5cf6; }
.timeline-dot-email    { background: #0ea5e9; }
.timeline-dot-whatsapp { background: #22c55e; }
.timeline-dot-nota     { background: var(--gray-400); }
.timeline-content { flex: 1; }
.timeline-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.timeline-fecha { margin-left: auto; }
.timeline-desc { font-size: 13px; color: var(--gray-700); }

/* ── Login page ──────────────────────────────────────────── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--nav-bg); }
.login-wrap { width: 100%; max-width: 380px; padding: 24px; }
.login-card { background: #151F32; border: 1px solid var(--nav-border); border-radius: var(--radius); padding: 36px 32px; box-shadow: 0 20px 60px rgba(0,0,0,0.4); }
.login-header { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 28px; }
.login-title { font-family: 'Sora', system-ui, sans-serif; font-size: 22px; font-weight: 700; color: #fff; }
.login-card label { color: var(--nav-text); }
.login-card .input { background: rgba(255,255,255,0.06); border-color: var(--nav-border); color: #fff; }
.login-card .input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-glow); }
.login-card .input::placeholder { color: #4a5568; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.btn-login { width: 100%; justify-content: center; padding: 9px 14px; font-size: 14px; }

/* ── Inline forms ────────────────────────────────────────── */
.add-form-details { margin-top: 12px; }
.add-form-details summary { cursor: pointer; user-select: none; }
.add-form-details[open] summary { margin-bottom: 10px; }
.inline-form { padding: 10px; background: var(--gray-50); border-radius: var(--radius); border: 1px solid var(--gray-200); }
.inline-form-row { display: flex; gap: 8px; align-items: center; }
.inline-form-col { display: flex; flex-direction: column; gap: 8px; }
.detail-main { display: flex; flex-direction: column; gap: 16px; }
