* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --verde: #0d312a;
  --verde-osc: #081f1a;
  --hueso: #e9e0d7;
  --fondo: #f4f2ee;
  --gris: #6b7280;
  --borde: #e3ddd3;
  --rojo: #b91c1c;
  --verde-ok: #15803d;
}
body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--fondo);
  color: #1a1a1a;
  -webkit-font-smoothing: antialiased;
}

/* ===== LOGIN ===== */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--verde);
}
.login-card {
  background: #fff;
  border-radius: 18px;
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.25);
}
.login-card { text-align: center; }
.login-card h1 { color: var(--verde); font-size: 1.5rem; margin-bottom: 4px; text-transform: uppercase; letter-spacing: -0.3px; }
.login-card .logo-login { height: 42px; width: auto; display: block; margin: 0 auto 12px; }
.login-card p.sub { color: var(--gris); font-size: 0.92rem; margin-bottom: 24px; }
.login-card #g-boton { display: flex; justify-content: center; }

/* ===== Botones / inputs comunes ===== */
button {
  font-family: inherit;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  padding: 11px 18px;
  font-size: 0.95rem;
  background: var(--verde);
  color: var(--hueso);
}
button:hover { background: var(--verde-osc); }
button.sec { background: #fff; color: var(--verde); border: 1px solid var(--borde); }
button.sec:hover { background: #faf8f4; }
button.peligro { background: #fff; color: var(--rojo); border: 1px solid #f0c8c8; }
button.peligro:hover { background: var(--rojo); color: #fff; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

label.campo { display: block; margin-bottom: 16px; }
label.campo > span { display: block; font-size: 0.85rem; font-weight: 700; color: #374151; margin-bottom: 6px; }
input, select, textarea {
  font-family: inherit;
  width: 100%;
  padding: 11px 12px;
  font-size: 1rem;
  border: 1.5px solid var(--borde);
  border-radius: 9px;
  outline: none;
  background: #fff;
}
input:focus, select:focus, textarea:focus { border-color: var(--verde); }
textarea { resize: vertical; min-height: 70px; }

.btn-full { width: 100%; }
.error { color: var(--rojo); font-size: 0.9rem; font-weight: 600; min-height: 1.2em; margin-top: 4px; }

/* ===== Layout app: sidebar + main ===== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--verde);
  color: var(--hueso);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .logo-side { height: 28px; width: auto; max-width: 150px; object-fit: contain; align-self: flex-start; display: block; margin: 4px 6px 22px; }
.sidebar .nuevo-btn {
  background: var(--hueso); color: var(--verde);
  width: 100%; margin-bottom: 22px; padding: 12px;
}
.sidebar .nuevo-btn:hover { background: #fff; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.navitem {
  background: transparent; color: rgba(233,224,215,0.8);
  text-align: left; border-radius: 9px; padding: 11px 14px; font-size: 0.96rem;
}
.navitem:hover { background: rgba(255,255,255,0.08); color: var(--hueso); }
.navitem.activa { background: rgba(255,255,255,0.14); color: #fff; }

.sidebar-pie { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.15); }
.sidebar-pie .quien { font-size: 0.82rem; opacity: 0.8; margin: 0 6px 10px; word-break: break-word; }
.sidebar-pie .salir-btn { background: rgba(255,255,255,0.1); color: var(--hueso); border: 1px solid rgba(255,255,255,0.2); width: 100%; }
.sidebar-pie .salir-btn:hover { background: rgba(255,255,255,0.2); }

.main { flex: 1; min-width: 0; padding: 28px 32px; }
.titulo-seccion { font-size: 1.5rem; color: var(--verde); text-transform: uppercase; letter-spacing: -0.3px; margin-bottom: 20px; }
.seccion-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.seccion-head .titulo-seccion { margin-bottom: 0; }

.seccion { display: none; }
.seccion.activa { display: block; }

/* Responsive: la barra pasa arriba en pantallas chicas */
@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; }
  .sidebar .logo-side { margin: 0 12px 0 0; }
  .sidebar .nuevo-btn { width: auto; margin: 0; order: 3; }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .sidebar-pie { margin: 0; padding: 0; border: none; display: flex; align-items: center; gap: 10px; }
  .sidebar-pie .quien { display: none; }
  .main { padding: 20px; }
}

/* Filtros */
.filtros { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.filtros input, .filtros select { width: auto; min-width: 160px; }
.filtros .crece { flex: 1; min-width: 220px; }

/* Tabla */
.tabla-wrap { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.06); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 16px; text-align: left; border-bottom: 1px solid #eef0f3; font-size: 0.93rem; white-space: nowrap; }
th { background: var(--verde); color: var(--hueso); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: #f6f4f0; }
.vacio { text-align: center; padding: 40px; color: #9ca3af; }

/* Chips de estado */
.chip { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; text-transform: capitalize; }
.chip.nuevo { background: #e0e7ff; color: #3730a3; }
.chip.contactado { background: #fef3c7; color: #92400e; }
.chip.sin_respuesta { background: #ece9e3; color: #6b6b6b; }
.chip.interesado { background: #cffafe; color: #155e75; }
.chip.venta { background: #dcfce7; color: var(--verde-ok); }
.chip.perdido { background: #fee2e2; color: #b91c1c; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi { background: #fff; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.06); padding: 18px; }
.kpi-num { font-size: 2rem; font-weight: 800; color: var(--verde); line-height: 1; }
.kpi-lbl { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gris); margin-top: 8px; font-weight: 700; }

.panel { background: #fff; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.06); padding: 20px; margin-bottom: 20px; }
.panel h2 { font-size: 1.1rem; color: var(--verde); text-transform: uppercase; margin-bottom: 14px; }

/* Modal (ficha de contacto) */
.modal-fondo { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: none; align-items: flex-start; justify-content: center; padding: 24px; overflow-y: auto; z-index: 50; }
.modal-fondo.abierto { display: flex; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 640px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal-cab { display: flex; justify-content: space-between; align-items: flex-start; padding: 22px 24px; border-bottom: 1px solid #eef0f3; }
.modal-cab h2 { font-size: 1.35rem; color: var(--verde); }
.modal-cab .cerrar { background: transparent; color: var(--gris); font-size: 1.6rem; padding: 0 6px; line-height: 1; }
.modal-cab .cerrar:hover { background: transparent; color: #111; }
.modal-cuerpo { padding: 22px 24px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

.historial { margin-top: 8px; max-height: 280px; overflow-y: auto; }
.evento { padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.evento:last-child { border-bottom: none; }
.evento .meta { font-size: 0.78rem; color: var(--gris); margin-bottom: 2px; }
.evento .txt { font-size: 0.93rem; }
.evento.nota .txt { background: #f6f4f0; padding: 8px 10px; border-radius: 8px; }
.evento.estado .txt { color: var(--verde); font-weight: 600; }
.evento.sistema .txt { color: var(--gris); font-style: italic; }

.btn-wpp { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; font-size: 0.88rem; font-weight: 700; background: #25d366; color: #fff; text-decoration: none; }
.btn-wpp:hover { background: #1ebe5a; }

/* Kanban / Pipeline */
.pipeline-ayuda { font-size: 0.85rem; color: var(--gris); }
.kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  align-items: start;
}
.kcol {
  background: #eef0ed;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-height: 120px;
}
.kcol.sobre { outline: 2px dashed var(--verde); outline-offset: -2px; background: #e6ebe4; }
.kcol-cab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 8px;
  position: sticky;
  top: 0;
}
.kcol-num { font-size: 0.85rem; font-weight: 800; color: var(--gris); }
.kcol-body { padding: 0 10px 12px; display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.kcard {
  background: #fff;
  border-radius: 10px;
  padding: 11px 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  cursor: grab;
  border: 1px solid #e9e6e0;
}
.kcard:hover { box-shadow: 0 3px 10px rgba(0,0,0,0.12); }
.kcard:active { cursor: grabbing; }
.kcard.arrastrando { opacity: 0.4; }
.kcard-nombre { font-weight: 700; color: #1a1a1a; font-size: 0.95rem; margin-bottom: 3px; }
.kcard-meta { font-size: 0.82rem; color: var(--gris); }
.kcard-premio { font-size: 0.82rem; color: var(--verde); font-weight: 700; margin-top: 4px; }
.kcard-tiempo { font-size: 0.74rem; color: #9ca3af; margin-top: 6px; }
.kcard-pie { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 8px; }
.kcard-resp { font-size: 0.76rem; color: var(--gris); }
.kcard-wpp { font-size: 0.95rem; text-decoration: none; }
.kcol-vacio { font-size: 0.8rem; color: #9ca3af; text-align: center; padding: 12px 0; }

/* Canal y etiquetas */
.canal-badge {
  display: inline-block; padding: 3px 10px; border-radius: 7px;
  font-size: 0.78rem; font-weight: 700; background: #e6efe9; color: var(--verde);
  text-transform: capitalize;
}
.tag {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 600; background: #efe9df; color: #6b5d49;
  margin-bottom: 2px;
}
.tags-editor { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-quitable { display: inline-flex; align-items: center; gap: 5px; padding-right: 5px; }
.tag-quitable button {
  background: transparent; color: #b91c1c; padding: 0; font-size: 1rem; line-height: 1;
  width: 16px; height: 16px; border-radius: 50%;
}
.tag-quitable button:hover { background: #f0d0d0; }
.kcard-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

/* Campañas */
.seg-conteo { font-size: 1.05rem; color: #374151; }
.seg-linea { display: flex; align-items: center; gap: 10px; }
.seg-num {
  flex-shrink: 0; min-width: 1.6em; text-align: center;
  background: var(--verde); color: var(--hueso); font-weight: 800;
  padding: 2px 12px; border-radius: 8px; font-size: 1.2rem;
}
.seg-nota { font-size: 0.85rem; color: var(--gris); margin-top: 6px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; }
.check input { width: auto; }
.camp-preview { margin-top: 14px; }
.preview-lbl { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; color: #9ca3af; font-weight: 700; margin-bottom: 6px; }
.preview-burbuja {
  background: #d9fdd3; color: #111; border-radius: 12px; border-top-left-radius: 2px;
  padding: 12px 14px; font-size: 0.95rem; white-space: pre-wrap; max-width: 460px; line-height: 1.4;
}
.camp-lista { display: flex; flex-direction: column; gap: 8px; }
.camp-fila {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; background: #faf8f4; border: 1px solid var(--borde); border-radius: 10px;
}
.camp-fila.enviado { background: #eaf6ea; border-color: #bfe3bf; }
.camp-info { display: flex; flex-direction: column; gap: 3px; font-size: 0.9rem; }
.camp-info span { color: var(--gris); }
.sin-tel { font-size: 0.82rem; color: var(--rojo); }
code { background: #ece9e3; padding: 1px 6px; border-radius: 5px; font-size: 0.85em; }

.mensaje { font-size: 0.9rem; font-weight: 600; min-height: 1.2em; }
.mensaje.ok { color: var(--verde-ok); }
.mensaje.err { color: var(--rojo); }
.fila-acc { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
