/* ── BASE ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: #eef3f9;
  margin: 0;
  color: #1e293b;
  font-size: 15px;
}

a { text-decoration: none; }

/* ── TOPBAR ───────────────────────────────────────────── */
.topbar {
  height: 60px;
  background: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid #dbe3ef;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.logo {
  font-size: 20px;
  font-weight: 800;
  color: #0176D3;
  white-space: nowrap;
}

.menu {
  display: flex;
  gap: 20px;
  align-items: center;
}

.menu a {
  color: #475569;
  font-weight: 600;
  font-size: 14px;
  transition: color .15s;
}
.menu a:hover { color: #0176D3; }

/* hamburger — oculto en desktop */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  border: none;
  background: none;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 2.5px;
  background: #475569;
  border-radius: 2px;
  transition: all .2s;
}

/* menú desplegable mobile */
.mobile-nav {
  display: none;
  flex-direction: column;
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 0;
  position: sticky;
  top: 60px;
  z-index: 99;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.mobile-nav a {
  padding: 12px 20px;
  color: #374151;
  font-weight: 600;
  font-size: 15px;
  border-bottom: 1px solid #f1f5f9;
}
.mobile-nav a:hover { background: #f8fafc; color: #0176D3; }
.mobile-nav.open { display: flex; }

/* ── CONTAINER ────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px;
}

/* ── HERO ─────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
  padding: 24px 20px;
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.hero h1 { margin: 0 0 4px; font-size: 22px; font-weight: 800; }
.hero p  { margin: 0; color: #475569; font-size: 14px; }

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── CARDS KPI ────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.card {
  background: white;
  padding: 20px;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  border-left: 4px solid #e2e8f0;
}

.card span {
  display: block;
  margin-bottom: 8px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.card strong {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
}

/* ── CHARTS ───────────────────────────────────────────── */
.charts {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.chart-box {
  background: white;
  padding: 20px;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.chart-box h3 {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── TABLE ────────────────────────────────────────────── */
.table-box {
  background: white;
  padding: 20px;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; min-width: 600px; }

th {
  padding: 10px 12px;
  text-align: left;
  background: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

td {
  padding: 11px 12px;
  border-top: 1px solid #f1f5f9;
  font-size: 13px;
  vertical-align: middle;
}

tr { cursor: pointer; }
tr:hover td { background: #f8fafc; }

/* ── LEAD GRID (ficha) ────────────────────────────────── */
.lead-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.lead-card {
  background: white;
  padding: 20px;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* ── BADGES ───────────────────────────────────────────── */
.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  display: inline-block;
  white-space: nowrap;
}
.temp-caliente { background: #ffe2e2; color: #b91c1c; }
.temp-frio     { background: #dbeafe; color: #1d4ed8; }
.temp-tibio    { background: #fef3c7; color: #92400e; }
.estado        { background: #eef2ff; color: #3730a3; }
.toca-si       { background: #fee2e2; color: #991b1b; }
.toca-no       { background: #dcfce7; color: #166534; }

/* ── BUTTONS ──────────────────────────────────────────── */
.btn-primary {
  background: #0176D3;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-block;
  text-decoration: none;
  transition: background .15s;
}
.btn-primary:hover { background: #014486; color: white; }

.btn-secondary {
  background: white;
  color: #374151;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  transition: border-color .15s;
}
.btn-secondary:hover { border-color: #0176D3; color: #0176D3; }

/* ── FOOTER ───────────────────────────────────────────── */
.crm-footer {
  background: white;
  border-top: 1px solid #e2e8f0;
  padding: 16px 20px;
  text-align: center;
  margin-top: 24px;
}
.crm-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  margin-bottom: 6px;
}
.crm-footer-links a { color: #64748b; font-size: 12px; font-weight: 600; }
.crm-footer-links a:hover { color: #0176D3; }
.crm-footer-links span { color: #e2e8f0; }
.crm-footer-copy { color: #94a3b8; font-size: 11px; line-height: 1.7; }

/* ════════════════════════════════════════════════════════
   RESPONSIVE — TABLET  (< 900px)
═══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .cards  { grid-template-columns: repeat(2, 1fr); }
  .charts { grid-template-columns: 1fr; }
  .lead-grid { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE  (< 640px)
═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .topbar { padding: 0 14px; }
  .logo   { font-size: 17px; }

  /* Ocultar menú desktop, mostrar hamburger */
  .menu       { display: none; }
  .hamburger  { display: flex; }

  .container { padding: 0 12px; margin: 14px auto; }

  .hero {
    padding: 18px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .hero h1 { font-size: 19px; }
  .hero-actions { width: 100%; }
  .hero-actions a { flex: 1; text-align: center; }

  .cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 14px;
  }
  .card { padding: 14px; }
  .card strong { font-size: 28px; }

  .chart-box { padding: 14px; }

  .table-box { padding: 12px; }
  table      { min-width: 500px; }

  .an-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .an-num { font-size: 24px !important; }
}

/* ════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE PEQUEÑO (< 480px)
   Fix: filter bar, bulk bar, kanban
═══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

  /* ── Barra de filtros ── */
  .filter-bar {
    padding: 10px;
    gap: 6px;
  }
  .filter-bar input[type="text"],
  .filter-bar input[type="search"] {
    width: 100%;
    box-sizing: border-box;
    font-size: 13px;
  }
  .filter-bar select {
    flex: 1 1 calc(50% - 3px);
    min-width: 0;
    font-size: 12px;
    padding: 7px 8px;
  }
  .filter-actions {
    display: flex;
    gap: 6px;
    width: 100%;
  }
  .filter-actions .btn-primary,
  .filter-actions .btn-secondary {
    flex: 1;
    text-align: center;
    padding: 8px 10px;
    font-size: 12px;
  }

  /* ── Bulk bar ── */
  #bulk-bar {
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: wrap;
  }
  #bulk-count {
    width: 100%;
    font-size: 13px !important;
  }
  .bulk-btn {
    flex: 1;
    padding: 8px 10px;
    font-size: 12px;
    text-align: center;
  }
}
