* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f4f4f2;
  color: #1f1f1f;
  min-height: 100vh;
}

.oculto { display: none !important; }

/* ---- Login ---- */

#pantalla-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.tarjeta {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  padding: 32px 24px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

h1 { margin: 0 0 8px; font-size: 22px; font-weight: 600; }
.subtitulo { margin: 0 0 24px; color: #666; font-size: 14px; }

/* ---- App shell ---- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid #e5e5e2;
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar .logo { font-weight: 600; font-size: 17px; }

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

h2 { font-size: 19px; font-weight: 600; margin: 16px 0 12px; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 10px; color: #444; }

/* ---- Forms / inputs shared ---- */

form { display: flex; flex-direction: column; gap: 12px; }

input, select, textarea {
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 8px;
  outline: none;
  font-family: inherit;
  width: 100%;
}

input:focus, select:focus, textarea:focus { border-color: #333; }

label { text-align: left; font-size: 13px; color: #555; display: flex; flex-direction: column; gap: 4px; }

button {
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: #1f1f1f;
  color: #fff;
  cursor: pointer;
}

button:active { opacity: 0.85; }
button:disabled { opacity: 0.5; }

button.secundario { background: #eee; color: #1f1f1f; }
button.peligro { background: #fff; color: #b3261e; border: 1px solid #b3261e; margin-top: 12px; width: 100%; }
button.link { background: none; color: #1f1f1f; padding: 4px 0; text-decoration: underline; font-weight: 400; }

.error { color: #b3261e; font-size: 14px; margin-top: 12px; }

/* ---- Home ---- */

.menu-acciones { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }

.lista-eventos { display: flex; flex-direction: column; gap: 2px; }

.evento {
  background: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 6px;
}

.evento .fecha { color: #999; font-size: 12px; white-space: nowrap; }

.vacio { color: #999; font-size: 14px; text-align: center; padding: 24px 0; }
.cargando { color: #999; font-size: 14px; text-align: center; padding: 24px 0; }

/* ---- Buscador / lista leads ---- */

#buscador { margin-bottom: 10px; }
.check-inline { display: flex; align-items: center; gap: 6px; font-size: 14px; color: #555; margin-bottom: 14px; }
.check-inline input { width: auto; }

.fila-lead {
  background: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
}

.fila-lead-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.detalle-fila { color: #777; font-size: 13px; margin-top: 4px; }

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eee;
  color: #555;
  white-space: nowrap;
}
.badge-frio { background: #e3f0ff; color: #1e5fa8; }
.badge-medio { background: #fff3d6; color: #9a6b00; }
.badge-caliente { background: #ffe1dd; color: #b3261e; }
.badge-descartado { background: #eee; color: #888; }

/* ---- Ficha de lead ---- */

.bloque {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
}

.item-contacto { border-bottom: 1px solid #eee; padding: 8px 0; font-size: 14px; }
.item-contacto:last-child { border-bottom: none; }
.item-contacto .fecha { color: #999; font-size: 12px; }
.item-contacto p { margin: 4px 0 0; }

.item-tarea { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; }
.item-tarea input { width: auto; }

.item-entrada {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}
.item-entrada:last-child { border-bottom: none; }
.item-entrada span { flex: 1; }
.item-entrada button { padding: 6px 10px; font-size: 13px; white-space: nowrap; }

#wrap-razon { margin-top: -4px; }

/* ---- Modal ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 20;
}

.modal-caja {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  width: 100%;
  max-width: 320px;
}

.modal-caja p { margin: 0 0 16px; font-size: 15px; }

.modal-botones { display: flex; gap: 10px; }
.modal-botones button { flex: 1; }
