/* ═══ RESET & BASE ═══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-bg:    #1a1d23;
  --sidebar-hover: #252831;
  --sidebar-active:#2d3142;
  --sidebar-text:  #9ca3af;
  --sidebar-label: #6b7280;
  --sidebar-border:#2a2e3a;

  --bg:            #f7f8fa;
  --surface:       #ffffff;
  --border:        #e5e7eb;
  --border-light:  #f0f2f5;

  --text:          #111827;
  --text-secondary:#6b7280;
  --text-muted:    #9ca3af;

  --accent:        #2563eb;
  --accent-hover:  #1d4ed8;
  --green:         #16a34a;
  --green-light:   #dcfce7;
  --orange:        #d97706;
  --orange-light:  #fef3c7;
  --red:           #dc2626;
  --red-light:     #fee2e2;
  --blue:          #2563eb;
  --blue-light:    #dbeafe;
  --purple:        #7c3aed;

  --wa:            #25d366;
  --wa-hover:      #1da851;

  --radius:        8px;
  --radius-lg:     12px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:     0 4px 12px rgba(0,0,0,.08);

  --sidebar-w:     220px;
  --panel-w:       380px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
}

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

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

/* ═══ SIDEBAR ═══════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--sidebar-border);
}
.logo-k {
  width: 30px; height: 30px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: white;
  flex-shrink: 0;
}
.logo-text { font-size: 15px; font-weight: 700; color: #ffffff; letter-spacing: -0.3px; }

.sidebar-nav { flex: 1; padding: 10px 0; }

.nav-group-label {
  padding: 16px 16px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .8px;
  color: var(--sidebar-label);
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--sidebar-text);
  cursor: pointer;
  border-radius: 0;
  transition: background .12s, color .12s;
  position: relative;
  user-select: none;
}
.nav-item:hover { background: var(--sidebar-hover); color: #e5e7eb; }
.nav-item.active {
  background: var(--sidebar-active);
  color: #ffffff;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: .6;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}
.nav-item.active .nav-icon { opacity: 1; }

.badge-nav {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
  display: none;
}
.badge-nav.show { display: block; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--sidebar-border);
  font-size: 11px;
  color: var(--sidebar-label);
  line-height: 1.6;
}

/* ═══ MAIN ══════════════════════════════════════════════════════════════════ */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  min-height: 100vh;
  background: var(--bg);
}

.section { display: none; padding: 28px 32px; }
.section.active { display: block; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.4px; }
.page-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ═══ TOOLBAR ═══════════════════════════════════════════════════════════════ */
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.search-input {
  flex: 1;
  min-width: 180px;
  max-width: 280px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--surface);
  outline: none;
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.filter-select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--surface);
  outline: none;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--accent); }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }

/* ═══ BUTTONS ═══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .12s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary   { background: var(--accent);  color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-wa        { background: var(--wa); color: #fff; border-color: var(--wa); }
.btn-wa:hover  { background: var(--wa-hover); }
.btn-success   { background: var(--green); color: #fff; border-color: var(--green); }
.btn-success:hover { background: #15803d; }
.btn-danger    { background: var(--red-light); color: var(--red); border-color: #fca5a5; }
.btn-danger:hover { background: #fecaca; }
.btn-ghost     { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-sm        { padding: 4px 10px; font-size: 12px; }
.btn-lg        { padding: 10px 18px; font-size: 14px; }
.btn-full      { width: 100%; }
.btn:disabled  { opacity: .5; cursor: not-allowed; }

/* ═══ CARDS ═════════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
}
.card-title { font-weight: 700; font-size: 14px; }
.card-count { font-size: 12px; color: var(--text-secondary); }

/* ═══ KPI GRID ══════════════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2,1fr); } }

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.kpi-label  { font-size: 12px; color: var(--text-secondary); font-weight: 500; margin-bottom: 6px; }
.kpi-value  { font-size: 28px; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.kpi-sub    { font-size: 11px; color: var(--text-secondary); margin-top: 6px; }
.kpi-green  .kpi-value { color: var(--green); }
.kpi-blue   .kpi-value { color: var(--blue); }
.kpi-orange .kpi-value { color: var(--orange); }
.kpi-red    .kpi-value { color: var(--red); }

/* ═══ CHARTS ════════════════════════════════════════════════════════════════ */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .charts-grid { grid-template-columns: 1fr; } }

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.chart-title { font-weight: 700; font-size: 13px; margin-bottom: 14px; color: var(--text-secondary); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ═══ TABLE ═════════════════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-professional thead tr {
  background: var(--bg);
  border-bottom: 2px solid var(--border);
}
th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-secondary);
  white-space: nowrap;
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }

.td-name { font-weight: 600; font-size: 13px; }
.td-sub  { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.td-muted { color: var(--text-secondary); font-size: 12px; }
.td-money { font-weight: 700; color: var(--green); }
.td-center { text-align: center; }

/* ═══ STATUS DOTS ═══════════════════════════════════════════════════════════ */
.status-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-red    { background: var(--red); }
.dot-yellow { background: var(--orange); }
.dot-green  { background: var(--green); }
.dot-blue   { background: var(--blue); }
.dot-gray   { background: var(--text-muted); }

.segment-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  flex-shrink: 0;
}
.seg-humano      { background: #2563eb; }
.seg-veterinario { background: #16a34a; }
.seg-distribuidor{ background: #7c3aed; }
.seg-uroanalisis { background: #d97706; }
.seg-equipos     { background: #0891b2; }

/* ═══ BADGES & PILLS ════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green  { background: var(--green-light);  color: var(--green); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-red    { background: var(--red-light);    color: var(--red); }
.badge-blue   { background: var(--blue-light);   color: var(--blue); }
.badge-gray   { background: var(--border-light); color: var(--text-secondary); }

.stage-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.seller-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.seller-zaira   { background: #ede9fe; color: #5b21b6; }
.seller-liliana { background: #fce7f3; color: #be185d; }
.seller-enrique { background: #dbeafe; color: #1d4ed8; }
.seller-caro    { background: #fef3c7; color: #92400e; }
.seller-none    { background: var(--border-light); color: var(--text-secondary); }

/* ═══ KANBAN BOARD ══════════════════════════════════════════════════════════ */
/* Wrapper makes the kanban scroll horizontally when needed */
.kanban-scroll-wrap {
  overflow-x: auto;
  padding-bottom: 12px;
  /* Force scrollbar always visible on macOS Safari */
  -webkit-overflow-scrolling: touch;
}
.kanban-scroll-wrap::-webkit-scrollbar { height: 6px; }
.kanban-scroll-wrap::-webkit-scrollbar-track { background: var(--border-light); border-radius: 3px; }
.kanban-scroll-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.kanban-board {
  display: grid;
  /* 7 equal columns, minimum 155px each — always all visible */
  grid-template-columns: repeat(7, minmax(155px, 1fr));
  gap: 10px;
  min-height: 400px;
  min-width: 1085px;   /* 7 × 155px + 6 × 10px gap */
  align-items: start;
}
.kanban-col {
  background: #f0f2f5;
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-width: 0;
}
.kanban-col-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
}
.kanban-stage-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.kanban-stage-label { flex: 1; }
.kanban-count {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  padding: 0 6px;
  min-width: 22px;
  text-align: center;
}
.kanban-col-body { padding: 8px; display: flex; flex-direction: column; gap: 6px; min-height: 100px; }
.kanban-empty { font-size: 11px; color: var(--text-muted); text-align: center; padding: 16px 0; }

/* Lead card in Kanban */
.lead-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  transition: box-shadow .12s, transform .1s;
  font-size: 13px;
}
.lead-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.lead-card-top  { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 5px; }
.lead-card-name { font-weight: 600; flex: 1; font-size: 13px; line-height: 1.3; }
.lead-card-seg  { font-size: 11px; color: var(--text-secondary); display: flex; align-items: center; margin-bottom: 3px; }
.lead-card-contact  { font-size: 11px; color: var(--text-muted); }
.lead-card-followup { font-size: 10px; color: var(--orange); margin-top: 3px; }
.lead-card-assigned { font-size: 10px; color: var(--accent); margin-top: 3px; font-weight: 500; }
.lead-tag {
  font-size: 9px; font-weight: 700; padding: 1px 5px;
  border-radius: 4px; flex-shrink: 0; margin-top: 2px;
}
.fb-tag { background: #dbeafe; color: #1d4ed8; }

/* ═══ SIDE PANEL ════════════════════════════════════════════════════════════ */
.panel-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.25);
  z-index: 99;
  display: none;
}
.panel-overlay.show { display: block; }

.lead-panel {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: var(--panel-w);
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 100;
  transform: translateX(100%);
  transition: transform .2s cubic-bezier(.25,.46,.45,.94);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -4px 0 20px rgba(0,0,0,.08);
}
.lead-panel.open { transform: translateX(0); }

.lead-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.panel-name { font-size: 16px; font-weight: 700; }
.panel-meta-small { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }
.panel-close {
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--text-secondary);
  padding: 2px 6px; border-radius: 4px;
  transition: background .1s;
}
.panel-close:hover { background: var(--bg); }

.lead-panel-body { flex: 1; overflow-y: auto; padding: 0; }

.panel-section {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
}
.panel-section:last-child { border-bottom: none; }
.panel-field-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-secondary); margin-bottom: 6px;
}
.panel-contact-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.panel-field { font-size: 13px; }
.panel-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.notes-list { display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; }
.notes-empty { font-size: 12px; color: var(--text-muted); padding: 8px 0; }
.note-item {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 8px 10px;
  border: 1px solid var(--border-light);
}
.note-text { font-size: 13px; }
.note-meta { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

/* ═══ FORM ELEMENTS ═════════════════════════════════════════════════════════ */
.form-input, .form-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--surface);
  outline: none;
  color: var(--text);
}
.form-input:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; color: var(--text-secondary); }

/* ═══ MODAL ═════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-sm { max-width: 420px; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; font-weight: 700; }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--text-secondary); padding: 2px 6px; border-radius: 4px;
}
.modal-close:hover { background: var(--bg); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }

/* ═══ BUENOS DÍAS MODAL ════════════════════════════════════════════════════ */
.bd-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.bd-fecha   { font-weight: 700; font-size: 15px; }
.bd-segmento{ font-size: 13px; color: var(--text-secondary); }

.bd-accion {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.bd-accion-label {
  padding: 10px 14px;
  background: var(--bg);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.bd-accion-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
}
.bd-accion-body:last-child { border-bottom: none; }
.bd-accion-info { flex: 1; min-width: 0; }
.bd-accion-nombre { font-weight: 600; font-size: 13px; }
.bd-accion-meta   { font-size: 12px; color: var(--text-secondary); margin-top: 2px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.bd-empty { padding: 12px 14px; font-size: 13px; color: var(--text-secondary); }

.bd-footer {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; text-align: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}
.bd-num       { font-size: 22px; font-weight: 800; }
.bd-num-label { font-size: 11px; color: var(--text-secondary); }

/* ═══ COBROS ════════════════════════════════════════════════════════════════ */
.cobros-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }

.cobro-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow);
}
.cobro-card.nivel-urgente    { border-left: 4px solid var(--red); }
.cobro-card.nivel-seguimiento{ border-left: 4px solid var(--orange); }
.cobro-card.nivel-amable     { border-left: 4px solid var(--blue); }

.cobro-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; gap: 8px; }
.cobro-name   { font-weight: 700; font-size: 15px; }
.cobro-meta   { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.cobro-nota   { font-size: 12px; color: var(--text-secondary); margin-bottom: 10px; }
.cobro-actions{ display: flex; gap: 6px; flex-wrap: wrap; }

/* ═══ ALERTAS ═══════════════════════════════════════════════════════════════ */
.alertas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.alerta-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.alerta-name { font-weight: 700; margin-bottom: 6px; }
.alerta-meta { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; line-height: 1.5; }
.alerta-days {
  font-size: 12px; font-weight: 600; margin-bottom: 10px;
  padding: 4px 8px; border-radius: 6px; display: inline-block;
}
.alerta-days.vencido { background: var(--red-light); color: var(--red); }
.alerta-days.proximo { background: var(--orange-light); color: var(--orange); }

/* ═══ CATÁLOGO ══════════════════════════════════════════════════════════════ */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 16px; }
.cat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow);
}
.cat-marca  { font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; margin-bottom: 8px; }
.cat-marca.certum  { color: #2563eb; }
.cat-marca.vechek  { color: #16a34a; }
.cat-marca.mission { color: #d97706; }
.cat-nombre { font-weight: 700; font-size: 14px; margin-bottom: 8px; line-height: 1.3; }
.cat-precio { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.cat-sub    { font-size: 12px; color: var(--text-secondary); }

/* ═══ COMISIONES ════════════════════════════════════════════════════════════ */
.comisiones-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 20px; }
@media (max-width: 900px) { .comisiones-grid { grid-template-columns: repeat(2,1fr); } }

/* ═══ BASE DE DATOS ═════════════════════════════════════════════════════════ */
.stats-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stats-row .kpi-card { flex: 1; min-width: 120px; max-width: 200px; }

/* Hot leads panel */
.hot-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.hot-panel-empty { border: 1px dashed var(--border); border-radius: var(--radius-lg); }
.hot-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}
.hot-panel-title { font-size: 13px; font-weight: 700; }
.hot-panel-meta  { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.hot-badge {
  font-size: 12px; font-weight: 700;
  padding: 2px 10px; border-radius: 10px;
}
.hot-badge-red    { background: var(--red-light);    color: var(--red); }
.hot-badge-yellow { background: var(--orange-light); color: var(--orange); }

.hot-leads-grid {
  display: flex; gap: 10px; overflow-x: auto;
  padding: 14px; flex-wrap: nowrap;
}
.hot-lead-card {
  flex: 0 0 200px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface);
}
.hot-card-red    { border-top: 3px solid var(--red); }
.hot-card-yellow { border-top: 3px solid var(--orange); }
.hot-card-blue   { border-top: 3px solid var(--blue); }

.hot-lead-top {
  display: flex; align-items: center; gap: 6px; margin-bottom: 5px;
}
.hot-lead-name     { font-weight: 600; font-size: 13px; flex: 1; }
.hot-days          { font-size: 11px; color: var(--text-secondary); flex-shrink: 0; }
.hot-lead-seg      { font-size: 11px; color: var(--text-secondary); margin-bottom: 5px; }
.hot-lead-campaign { font-size: 10px; color: var(--text-muted); margin-bottom: 8px; }
.hot-lead-actions  { margin-top: 8px; }

/* ═══ MISC ══════════════════════════════════════════════════════════════════ */
.loading {
  padding: 60px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}
.empty {
  padding: 60px;
  text-align: center;
  color: var(--text-secondary);
}
.empty-text { font-size: 14px; margin-top: 8px; }

.top-client-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.top-client-item:last-child { border-bottom: none; }
.rank-num {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.rank-num.top3 { background: var(--orange-light); color: var(--orange); border-color: var(--orange); }
.top-client-info { flex: 1; min-width: 0; }
.top-client-name { font-weight: 700; font-size: 13px; }
.top-client-meta { font-size: 11px; color: var(--text-secondary); margin-top: 2px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.top-client-ltv  { font-weight: 800; color: var(--green); font-size: 14px; flex-shrink: 0; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  font-size: 13px;
}
.page-info { color: var(--text-secondary); }
.divider { border: none; border-top: 1px solid var(--border-light); margin: 12px 0; }

/* ═══ TOAST ═════════════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1f2937;
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  z-index: 300;
  opacity: 0;
  transform: translateY(8px);
  transition: all .2s;
  pointer-events: none;
}
.toast.show        { opacity: 1; transform: translateY(0); }
.toast.toast-success { background: var(--green); }
.toast.toast-error   { background: var(--red); }
.toast.toast-info    { background: #1f2937; }

/* ═══ IMPORT RESULT MODAL ═══════════════════════════════════════════════════ */
.import-summary {
  display: flex; gap: 12px; margin-bottom: 20px;
}
.import-stat {
  flex: 1; text-align: center; padding: 16px 12px;
  background: var(--bg); border-radius: var(--radius);
  border: 1px solid var(--border);
}
.import-stat-num   { font-size: 28px; font-weight: 700; line-height: 1; }
.import-stat-label { font-size: 11px; color: var(--text-secondary); margin-top: 5px; text-transform: uppercase; letter-spacing: .5px; }
.import-stat-green  .import-stat-num { color: var(--green); }
.import-stat-orange .import-stat-num { color: var(--orange); }
.import-stat-gray   .import-stat-num { color: var(--text-muted); }

.import-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.import-file-tag {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; padding: 3px 10px;
  font-size: 11px; color: var(--text-secondary);
}

/* ─── Duplicates list ─── */
.dup-section { border-top: 1px solid var(--border); padding-top: 16px; }
.dup-section-title {
  font-weight: 600; font-size: 13px; color: var(--orange);
  margin-bottom: 10px;
}
.dup-section-empty { color: var(--text-secondary); font-size: 13px; padding: 8px 0; }

.dup-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border-light);
}
.dup-item:last-child { border-bottom: none; }
.dup-info  { flex: 1; min-width: 0; }
.dup-names { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 4px; flex-wrap: wrap; }
.dup-csv-name      { font-weight: 600; color: var(--text); }
.dup-arrow         { color: var(--text-muted); }
.dup-existing-name { color: var(--text-secondary); }
.dup-reason {
  display: inline-block; font-size: 11px;
  padding: 2px 7px; border-radius: 4px; font-weight: 500;
}
.dup-reason-phone { background: var(--orange-light); color: var(--orange); }
.dup-reason-email { background: var(--blue-light);   color: var(--blue);   }
.dup-reason-fb    { background: var(--border-light); color: var(--text-secondary); }

.dup-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* Ghost button */
.btn-ghost {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg); border-color: var(--text-muted); }

/* ─── Duplicate flag in Base de Datos table ─── */
.dup-dot-inline {
  color: var(--orange); font-size: 9px; vertical-align: middle;
  margin-right: 2px;
}
.row-dup-flagged td { background: #fff8f0; }
.row-dup-flagged:hover td { background: #fff3e5 !important; }

/* ═══ PIPELINE FUNNEL (Dashboard) ══════════════════════════════════════════ */
.funnel-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 24px; margin-bottom: 24px;
}
.funnel-title { font-weight: 700; font-size: 14px; margin-bottom: 16px; color: var(--text); }
.funnel-stages { display: flex; align-items: stretch; gap: 0; }
.funnel-stage {
  flex: 1; text-align: center; padding: 12px 6px;
  border-right: 1px solid var(--border-light);
  position: relative;
}
.funnel-stage:last-child { border-right: none; }
.funnel-stage-num { font-size: 22px; font-weight: 800; line-height: 1; }
.funnel-stage-label { font-size: 10px; color: var(--text-secondary); margin-top: 4px; text-transform: uppercase; letter-spacing: .4px; }
.funnel-stage-bar {
  height: 4px; border-radius: 2px; margin: 8px auto 0; width: 60%;
}
.funnel-conv { font-size: 10px; color: var(--text-muted); margin-top: 3px; }

/* Ganado column — verde */
.kanban-col.col-ganado .kanban-col-header { background: #f0fdf4; border-bottom-color: #bbf7d0; }
.kanban-col.col-perdido .kanban-col-header { background: #fff5f5; border-bottom-color: #fca5a5; }

/* Lead card special states */
.lead-card.card-ganado { border-color: #bbf7d0; background: #f0fdf4; }
.lead-card.card-perdido { border-color: #fca5a5; background: #fff5f5; opacity: 0.8; }

/* ═══ LEADS PERDIDOS VIEW ════════════════════════════════════════════════════ */
.perdido-reason {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 4px;
  background: #fff5f5; color: #dc2626; border: 1px solid #fca5a5; font-weight: 500;
}
.btn-reactivar {
  background: #f0fdf4; color: var(--green); border: 1px solid #bbf7d0;
  padding: 4px 10px; border-radius: var(--radius); font-size: 12px; font-weight: 600; cursor: pointer;
}
.btn-reactivar:hover { background: var(--green); color: white; }

/* (kanban rules are above in the KANBAN BOARD section) */
